Make SpecialContributionsBeforeMainOutput hook more useful
authorKunal Mehta <legoktm@gmail.com>
Sat, 21 Dec 2013 07:50:57 +0000 (23:50 -0800)
committerKunal Mehta <legoktm@gmail.com>
Sat, 21 Dec 2013 07:50:57 +0000 (23:50 -0800)
The current id number is useless for IP addresses, so it now
passes a proper User object.

For context, the SpecialPage instance is also provided.

Change-Id: Ie196611d504b3969bcdfb5c589716af2f3c54e14

docs/hooks.txt
includes/specials/SpecialContributions.php

index 53382f4..ebc412b 100644 (file)
@@ -2208,7 +2208,9 @@ $sp: SpecialPage object, for context
 &$fields: Current HTMLForm fields
 
 'SpecialContributionsBeforeMainOutput': Before the form on Special:Contributions
-$id: User identifier
+$id: User id number, only provided for backwards-compatability
+$user: User object representing user contributions are being fetched for
+$sp: SpecialPage instance, providing context
 
 'SpecialListusersDefaultQuery': Called right before the end of
 UsersPager::getDefaultQuery().
index af6a35b..551b972 100644 (file)
@@ -168,7 +168,7 @@ class SpecialContributions extends SpecialPage {
                // Add RSS/atom links
                $this->addFeedLinks( array( 'action' => 'feedcontributions', 'user' => $target ) );
 
-               if ( wfRunHooks( 'SpecialContributionsBeforeMainOutput', array( $id ) ) ) {
+               if ( wfRunHooks( 'SpecialContributionsBeforeMainOutput', array( $id, $userObj, $this ) ) ) {
                        $out->addHTML( $this->getForm() );
 
                        $pager = new ContribsPager( $this->getContext(), array(