]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/User.php
Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x
[quix0rs-gnu-social.git] / classes / User.php
index d04f7d679ffca7abbd3858b377053cd88d42a1a5..484dc8c82b30a09cd19ebf92366d4a460898a60a 100644 (file)
@@ -180,6 +180,27 @@ class User extends Memcached_DataObject
         return $result;
     }
 
+    /**
+     * Register a new user account and profile and set up default subscriptions.
+     * If a new-user welcome message is configured, this will be sent.
+     *
+     * @param array $fields associative array of optional properties
+     *              string 'bio'
+     *              string 'email'
+     *              bool 'email_confirmed' pass true to mark email as pre-confirmed
+     *              string 'fullname'
+     *              string 'homepage'
+     *              string 'location' informal string description of geolocation
+     *              float 'lat' decimal latitude for geolocation
+     *              float 'lon' decimal longitude for geolocation
+     *              int 'location_id' geoname identifier
+     *              int 'location_ns' geoname namespace to interpret location_id
+     *              string 'nickname' REQUIRED
+     *              string 'password' (may be missing for eg OpenID registrations)
+     *              string 'code' invite code
+     *              ?string 'uri' permalink to notice; defaults to local notice URL
+     * @return mixed User object or false on failure
+     */
     static function register($fields) {
 
         // MAGICALLY put fields into current scope
@@ -329,7 +350,7 @@ class User extends Memcached_DataObject
 
         $profile->query('COMMIT');
 
-        if ($email && !$user->email) {
+        if (!empty($email) && !$user->email) {
             mail_confirm_address($user, $confirm->code, $profile->nickname, $email);
         }
 
@@ -522,7 +543,7 @@ class User extends Memcached_DataObject
 
         // NOTE: we sort by fave time, not by notice time!
 
-        $qry .= 'ORDER BY notice.id DESC ';
+        $qry .= 'ORDER BY notice_id DESC ';
 
         if (!is_null($offset)) {
             $qry .= "LIMIT $limit OFFSET $offset";