From 4c9d5a0eb09ccae4b853be23b691127f1fc648b7 Mon Sep 17 00:00:00 2001 From: Nathaniel Herman Date: Fri, 16 Jan 2009 23:34:38 +0000 Subject: [PATCH] Add new hook 'UserLoadFromDatabase' that is called while loading a user from the database. --- RELEASE-NOTES | 4 +++- docs/hooks.txt | 4 ++++ includes/User.php | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 9cb11eecbc..3fc95a3c64 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 diff --git a/docs/hooks.txt b/docs/hooks.txt index 63037113db..895ef1be8f 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -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 diff --git a/includes/User.php b/includes/User.php index d1f285893e..dd823cc6fd 100644 --- a/includes/User.php +++ b/includes/User.php @@ -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 ); -- 2.20.1