Last modified: 2008-05-04 07:55:07 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 12542 - Add hooks to SpecialListusers.php to allow for expansion of it's use, without hacking core.
Add hooks to SpecialListusers.php to allow for expansion of it's use, without...
Product: MediaWiki
Classification: Unclassified
Special pages (Other open bugs)
All All
: Normal enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch, patch-need-review
Depends on:
  Show dependency treegraph
Reported: 2008-01-08 07:41 UTC by Daniel Friesen
Modified: 2008-05-04 07:55 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---

Patch to MediaWiki 1.12 (r29412) to add the hooks. (1.85 KB, patch)
2008-01-08 07:41 UTC, Daniel Friesen

Description Daniel Friesen 2008-01-08 07:41:16 UTC
Created attachment 4522 [details]
Patch to MediaWiki 1.12 (r29412) to add the hooks.

I've seen a few example cases, and one live case where users have wanted, or are using a altered version of [[Special:Listusers]]. Unfortunately, this always means that they are required to hack the core code, and need to re-hack it whenever they upgrade.

People can use shared users, add sso systems with more user data, and expand the data on a user all without hacking core. Unfortunately, if they want to change the data displayed on the user list, then they have to hack core to do it. It would be nice to be able to do that, without making upgrades tougher.

I made a patch which introduces 5 new hooks to includes/SpecialListusers.php:
SpecialListusersQueryInfo: Allows for chaning/expanding the sql query array.
SpecialListusersFormatRow: Allows for changes to the output of the user rows.
SpecialListusersHeaderForm: Allows for additions to the header form.
SpecialListusersHeader: Allows for additions to the header outside of the form.
SpecialListusersDefaultQuery: Allows for new defaults to the default query.

If you want some example use cases where this could prove useful:

Filtering out global users and displaying local users:
Wikia is a good example of this. They've got thousands of users, but they are all spread out over thousands of wiki. As a result the list users page got to be extremely large, and near useless because 99% of the users on a wiki's user list weren't part of the wiki. So they did some work and made the listusers page filtered. Unfortunately, this required the hacking of the core code, and now work needs to be done to put it back during every upgrade. If the hooks were added, this kind of thing could be done using hooks instead, and no core hacking would need to be done on upgrades.
* SpecialListusersQueryInfo would allow for filtering of the SQL query.
* SpecialListusersHeaderForm would allow for an option to disable the filtering using an extra option.
* SpecialListusersDefaultQuery would be used to add a default option to have filtering on.

Adding user data from a sso:
Sometimes a site using a SSO may actually use different user names for global SSO users, than for local wiki users. Or they may have links to central profiles, or other user data they would like to show up on the listusers special page.
* SpecialListusersQueryInfo would allow for extra querying on needed data like a user_id, or perhaps some table data that identifies what sso user the account is linked to.
* SpecialListusersFormatRow would allow the extra data such as user data, global names, or links to a central profile to be added to the row.

Filtering out spam usernames:
Sometimes a wiki is hit by users who just create a user with a vandalized username, just to vandalize the listusers page. Unfortunately, on some sites a shared database is used, or there is some other limitation that stops them from being able to rename or delete these names, and the listusers page becomes a vandalized page which can't be cleaned. However, it would be possible for a extension to filter out these names from displaying in the listusers page.
* SpecialListusersQueryInfo would be used to add a query, which in conjunction with either a new column in the user table, or a shared table with a list of users to not show would allow selected users to be excluded from listing.

If you're wondering a use of SpecialListusersHeader, it could be used for various uses. Perhaps something like a notice on the page, or adding some other type of option outside of the form (below it, instead of inside the form to the left of the submit link). Or, something like a form for quick user promotion could be added through a hook by adding the form input here, adding the checkboxes with SpecialListusersFormatRow and then using an existing hook which works before page output to add the opening and closing form tags.
Comment 1 Daniel Friesen 2008-01-08 07:42:55 UTC
Ok, just to note. Unlike my last patch, I did make sure that this works before I posted this.
Comment 2 Roan Kattouw 2008-03-02 14:15:14 UTC
Modified version of patch applied in r31453.
Comment 3 Daniel Friesen 2008-05-04 07:55:07 UTC
Added missing RELEASE-NOTE in r34197.

Note You need to log in before you can comment on or make changes to this bug.