* Introduce 'UserEffectiveGroups' hook; see docs/hooks.txt for more information
authorRob Church <robchurch@users.mediawiki.org>
Wed, 27 Jun 2007 14:32:31 +0000 (14:32 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Wed, 27 Jun 2007 14:32:31 +0000 (14:32 +0000)
* Add User::getRegistration() accessor

RELEASE-NOTES
docs/hooks.txt
includes/User.php

index ef4f213..80bf023 100644 (file)
@@ -109,6 +109,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   classes: mw-code, mw-css, mw-js)
 * (bug 6711) Add $wgAddGroups and $wgRemoveGroups to allow finer control over
   usergroup assignment.
+* Introduce 'UserEffectiveGroups' hook; see docs/hooks.txt for more information
 
 == Bugfixes since 1.10 ==
 
index 0886c0c..6f188e9 100644 (file)
@@ -637,6 +637,10 @@ $article: article object watched
 $user: user that watched
 $article: article object that was watched
 
+'UserEffectiveGroups': Called in User::getEffectiveGroups()
+$user: User to get groups for
+&$groups: Current effective groups
+
 'CategoryPageView': before viewing a categorypage in CategoryPage::view
 $catpage: CategoryPage instance
 
index 259c83b..426090e 100644 (file)
@@ -1637,6 +1637,8 @@ class User {
                                                $this->mEffectiveGroups[] = 'emailconfirmed';
                                        }
                                }
+                               # Hook for additional groups
+                               wfRunHooks( 'UserEffectiveGroups', array( &$this, &$this->mEffectiveGroups ) );
                        }
                }
                return $this->mEffectiveGroups;
@@ -2467,6 +2469,18 @@ class User {
                        $this->mEmailToken &&
                        $this->mEmailTokenExpires > wfTimestamp();
        }
+       
+       /**
+        * Get the timestamp of account creation, or false for
+        * non-existent/anonymous user accounts
+        *
+        * @return mixed
+        */
+       public function getRegistration() {
+               return $this->mId > 0
+                       ? $this->mRegistration
+                       : false;
+       }
 
        /**
         * @param array $groups list of groups