(bug 12542) Adding a bunch of hooks to SpecialListusers.php, modified patch by Daniel...
authorRoan Kattouw <catrope@users.mediawiki.org>
Sun, 2 Mar 2008 14:14:43 +0000 (14:14 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Sun, 2 Mar 2008 14:14:43 +0000 (14:14 +0000)
docs/hooks.txt
includes/SpecialListusers.php

index 1a0dd33..eebdfe7 100644 (file)
@@ -962,6 +962,26 @@ $content_actions: array of tabs
 'SpecialContributionsBeforeMainOutput': Before the form on Special:Contributions
 $id: User identifier
 
+'SpecialListusersDefaultQuery': called right before the end of UsersPager::getDefaultQuery()
+$pager: The UsersPager instance
+$query: The query array to be returned
+
+'SpecialListusersFormatRow': called right before the end of UsersPager::formatRow()
+$item: HTML to be returned. Will be wrapped in <li></li> after the hook finishes
+$row: Database row object
+
+'SpecialListusersHeader': called before closing the <fieldset> in UsersPager::getPageHeader()
+$pager: The UsersPager instance
+$out: The header HTML
+
+'SpecialListusersHeaderForm': called before adding the submit button in UsersPager::getPageHeader()
+$pager: The UsersPager instance
+$out: The header HTML
+
+'SpecialListusersQueryInfo': called right before the end of UsersPager::getQueryInfo()
+$pager: The UsersPager instance
+$query: The query array to be returned
+
 'SpecialMovepageAfterMove': called after moving a page
 $movePage: MovePageForm object
 $oldTitle: old title (object)
index 460d425..48e0819 100644 (file)
@@ -68,7 +68,7 @@ class UsersPager extends AlphabeticPager {
 
                list ($user,$user_groups,$ipblocks) = wfGetDB()->tableNamesN('user','user_groups','ipblocks');
 
-               return array(
+               $query = array(
                        'tables' => " $user LEFT JOIN $user_groups ON user_id=ug_user LEFT JOIN $ipblocks ON user_id=ipb_user AND ipb_auto=0 ",
                        'fields' => array('user_name',
                                'MAX(user_id) AS user_id',
@@ -78,6 +78,8 @@ class UsersPager extends AlphabeticPager {
                        'conds' => $conds
                );
 
+               wfRunHooks( 'SpecialListusersQueryInfo', array( $this, &$query ) );
+               return $query;
        }
 
        function formatRow( $row ) {
@@ -94,8 +96,10 @@ class UsersPager extends AlphabeticPager {
                } else {
                        $groups = '';
                }
-
-               return '<li>' . wfSpecialList( $name, $groups ) . '</li>';
+               
+               $item = wfSpecialList( $name, $groups );
+               wfRunHooks( 'SpecialListusersFormatRow', array( &$item, $row ) );
+               return "<li>{$item}</li>";
        }
 
        function getBody() {
@@ -136,11 +140,14 @@ class UsersPager extends AlphabeticPager {
                        $out .= Xml::option( User::getGroupName( $group ), $group, $group == $this->requestedGroup );
                $out .= Xml::closeElement( 'select' ) . ' ';
 
+               wfRunHooks( 'SpecialListusersHeaderForm', array( $this, &$out ) );
+
                # Submit button and form bottom
                if( $this->mLimit )
                        $out .= Xml::hidden( 'limit', $this->mLimit );
-               $out .= Xml::submitButton( wfMsg( 'allpagessubmit' ) ) .
-                       '</fieldset>' .
+               $out .= Xml::submitButton( wfMsg( 'allpagessubmit' ) );
+               wfRunHooks( 'SpecialListusersHeader', array( $this, &$out ) );
+               $out .= '</fieldset>' .
                        Xml::closeElement( 'form' );
 
                return $out;
@@ -156,6 +163,7 @@ class UsersPager extends AlphabeticPager {
                        $query['group'] = $this->requestedGroup;
                if( $this->requestedUser != '' )
                        $query['username'] = $this->requestedUser;
+               wfRunHooks( 'SpecialListusersDefaultQuery', array( $this, &$query ) );
                return $query;
        }
 
@@ -213,5 +221,3 @@ function wfSpecialListusers( $par = null ) {
 
        $wgOut->addHTML( $s );
 }
-
-