From 55869c8871c9a7e27d662ce6941a57bdac7b2334 Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Fri, 20 Dec 2013 23:50:57 -0800 Subject: [PATCH] Make SpecialContributionsBeforeMainOutput hook more useful 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 | 4 +++- includes/specials/SpecialContributions.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/hooks.txt b/docs/hooks.txt index 53382f4d67..ebc412b655 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -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(). diff --git a/includes/specials/SpecialContributions.php b/includes/specials/SpecialContributions.php index af6a35bc19..551b9727e8 100644 --- a/includes/specials/SpecialContributions.php +++ b/includes/specials/SpecialContributions.php @@ -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( -- 2.20.1