Introduce 'FetchChangesList' hook; see docs/hooks.txt for more information
authorRob Church <robchurch@users.mediawiki.org>
Wed, 21 Jun 2006 00:18:55 +0000 (00:18 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Wed, 21 Jun 2006 00:18:55 +0000 (00:18 +0000)
RELEASE-NOTES
docs/hooks.txt
includes/ChangesList.php

index fd5a1c4..200a490 100644 (file)
@@ -526,6 +526,7 @@ Some default configuration options have changed:
 * (bug 6174) Remove redundant "emailforlost" message 
 * (bug 6189) Show an error to an unprivilleged user trying to create account
 * (bug 6365) Show user information in the "old revision" navigation links
+* Introduce 'FetchChangesList' hook; see docs/hooks.txt for more information
 
 == Compatibility ==
 
index a8c0ff1..16db940 100644 (file)
@@ -335,6 +335,12 @@ $from: address of sending user
 $subject: subject of the mail
 $text: text of the mail
 
+'FetchChangesList': When fetching the ChangesList derivative for a particular user
+&$user: User the list is being fetched for
+&$skin: Skin object to be used with the list
+&$list: List object (defaults to NULL, change it to an object instance and return
+false override the list derivative used)
+
 'GetInternalURL': modify fully-qualified URLs used for squid cache purging
 $title: Title object of page
 $url: string value as output (out parameter, can modify)
index 84aadb3..b2c1abe 100644 (file)
@@ -39,12 +39,20 @@ class ChangesList {
                $this->preCacheMessages();
        }
 
+       /**
+        * Fetch an appropriate changes list class for the specified user
+        * Some users might want to use an enhanced list format, for instance
+        *
+        * @param $user User to fetch the list class for
+        * @return ChangesList derivative
+        */
        function newFromUser( &$user ) {
                $sk =& $user->getSkin();
-               if( $user->getOption('usenewrc') ) {
-                       return new EnhancedChangesList( $sk );
+               $list = NULL;
+               if( wfRunHooks( 'FetchChangesList', array( &$user, &$skin, &$list ) ) ) {
+                       return $user->getOption( 'usenewrc' ) ? new EnhancedChangesList( $sk ) : new OldChangesList( $sk );
                } else {
-                       return new OldChangesList( $sk );
+                       return $list;
                }
        }