public static function create($cols = array())
    {
        global $PPHP;
        $db = $PPHP['db'];
        $onetime = null;

        if (isset($cols['id'])) {
            unset($cols['id']);
        };

        $cols['email'] = strtolower($cols['email']);
        if (isset($cols['token']) && strlen($cols['token']) > 0) {
            $cols['password'] = $cols['token'];
        };
        if (isset($cols['password']) && strlen($cols['password']) > 0) {
            $cols['passwordHash'] = password_hash($cols['password'], PASSWORD_DEFAULT);
            // Else passwordHash will be '*' per table definition
        };
        if (isset($cols['onetime'])) {
            $onetime = md5(mcrypt_create_iv(32, MCRYPT_DEV_URANDOM));
            $cols['onetimeHash'] = password_hash($onetime, PASSWORD_DEFAULT);
        };
        if (($result = $db->insert('users', $cols)) !== false) {
            $creator = $result;
            if (isset($_SESSION['user']) && is_array($_SESSION['user'])) {
                $creator = $_SESSION['user']['id'];
            };
            trigger(
                'log',
                array(
                    'userId'     => $creator,
                    'objectType' => 'user',
                    'objectId'   => $result,
                    'action'     => 'created'
                )
            );
            // If we're creating someone else's account, automatic approval of the e-mail address
            if (pass('can', 'create', 'user')) {
                trigger('grant', $result, 'member');
            };

        };
        return $result ? array($result, $onetime) : $result;
    }