Add new hook 'UserLoadFromDatabase' that is called while loading a user from the...
authorNathaniel Herman <pinky@users.mediawiki.org>
Fri, 16 Jan 2009 23:34:38 +0000 (23:34 +0000)
committerNathaniel Herman <pinky@users.mediawiki.org>
Fri, 16 Jan 2009 23:34:38 +0000 (23:34 +0000)
RELEASE-NOTES
docs/hooks.txt
includes/User.php

index 9cb11ee..3fc95a3 100644 (file)
@@ -37,7 +37,9 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * When using 'UserCreateForm' hook to add new checkboxes into Special:UserLogin/signup,
   the messages can now contain HTML to allow hyperlinking to the site's Terms
   of Service page, for example
-  
+* Add new hook 'UserLoadFromDatabase' that is called while loading a user
+  from the database.
+
 === Bug fixes in 1.15 ===
 * (bug 16968) Special:Upload no longer throws useless warnings.
 * (bug 17000) Special:RevisionDelete now checks if the database is locked before
index 6303711..895ef1b 100644 (file)
@@ -1390,6 +1390,10 @@ $user: User to get rights for
 $user: user object
 $name: user name
 
+'UserLoadFromDatabase': called when loading a user from the database
+$user: user object
+&$s: database query object
+
 'UserLoadFromSession': called to authenticate users on external/environmental means; occurs before session is loaded
 $user: user object being loaded
 &$result: set this to a boolean value to abort the normal authentification process
index d1f2858..dd823cc 100644 (file)
@@ -886,6 +886,8 @@ class User {
                $dbr = wfGetDB( DB_MASTER );
                $s = $dbr->selectRow( 'user', '*', array( 'user_id' => $this->mId ), __METHOD__ );
 
+               wfRunHooks( 'UserLoadFromDatabase', array( $this, &$s ) );
+
                if ( $s !== false ) {
                        # Initialise user table data
                        $this->loadFromRow( $s );