From 32a775085531249fa7facf3d0ab19aea88749629 Mon Sep 17 00:00:00 2001 From: Rob Church Date: Wed, 27 Jun 2007 14:32:31 +0000 Subject: [PATCH] * Introduce 'UserEffectiveGroups' hook; see docs/hooks.txt for more information * Add User::getRegistration() accessor --- RELEASE-NOTES | 1 + docs/hooks.txt | 4 ++++ includes/User.php | 14 ++++++++++++++ 3 files changed, 19 insertions(+) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index ef4f213ff8..80bf0230b3 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 == diff --git a/docs/hooks.txt b/docs/hooks.txt index 0886c0c37a..6f188e931a 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -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 diff --git a/includes/User.php b/includes/User.php index 259c83bb29..426090ec12 100644 --- a/includes/User.php +++ b/includes/User.php @@ -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 -- 2.20.1