Last modified: 2009-05-24 12:16:02 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T20761, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 18761 - Add setting to hide a list of preferences
Add setting to hide a list of preferences
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
User preferences (Other open bugs)
1.16.x
All All
: Normal enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-05-11 05:19 UTC by Dan Jacobson
Modified: 2009-05-24 12:16 UTC (History)
10 users (show)

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


Attachments
Changes to Preferences.php and DefaultSettings.php against trunk@50475 (1.39 KB, patch)
2009-05-12 02:37 UTC, Autocracy
Details
Implement $wgHiddenPrefs (3.15 KB, patch)
2009-05-17 00:26 UTC, Chad H.
Details
Better comment (524 bytes, patch)
2009-05-20 01:19 UTC, Dan Jacobson
Details

Description Dan Jacobson 2009-05-11 05:19:21 UTC
In Preferences users are asked their gender.

Even though they can choose gender-unknown, we administrators would be
more comfortable if there was a configuration choice for our wikis so
such questions never appear. At least a hook.

Just let our wiki be all gender-unknown.

Not only would my http://transgender-taiwan.org/ benefit, but I'm sure
many other wikis would opt for such a choice.
Comment 1 Niklas Laxström 2009-05-11 10:22:26 UTC
I'm not convinced this is needed, but if somebody wants to add it I do not oppose.
Comment 2 Chad H. 2009-05-11 21:08:57 UTC
Per Niklas, this isn't really needed, so marking as WONTFIX.

However, this can be easily accomplished for any single preference a wiki admin wants to hide. In LocalSettings:
> 
> $wgHooks['GetPreferences'][] = 'hookfunc';
> 
> function hookfunc( &$user, &$prefs ) {
>    if ( isset( $prefs['gender'] ) ) {
>       unset( $prefs['gender'] );
>    }
>    return true;
> }

And 'gender' can be replaced with any of the preference keys.
Comment 3 MZMcBride 2009-05-11 21:14:52 UTC
Eh, we make the real name field optional. I don't see a reason to make gender non-optional, esp. for single wiki installations that are all English (or some other language where gender is completely unimportant). Recommend re-opening this and adding a configuration option.
Comment 4 Chad H. 2009-05-11 21:26:19 UTC
And if the real name question had come up now, I would say the same thing. It's much easier for wiki admins to just make an individual hook function to control these, rather than add a new variable every time 1 person decides they don't want to show a particular preference.
Comment 5 Roan Kattouw 2009-05-11 22:26:57 UTC
Instead of the relatively ugly hook, maybe $wgDisabledPreferences or something in that spirit would be a better (at least cleaner / more usable) idea.
Comment 6 Dan Jacobson 2009-05-11 22:41:39 UTC
Or just "add another column" or two to $wgDefaultUserOptions.
(Make into a list of lists).
Then several properties could be added...

Comment 7 Dan Jacobson 2009-05-11 22:46:15 UTC
Ah yes, a clever change to DefaultSettings.php would be all that is
needed. Older scripts would still get the scalar value, whilst scripts
'in the know' could access the remaining properties. It is getting hot
in here. I'll adjust the air conditioner. Be back soon.
Comment 8 MZMcBride 2009-05-12 01:27:14 UTC
I'm re-opening this for now. WONTFIX is "we're never, ever gonna do this so stop asking." Comment 5 indicates one way to have this functionality. Comment 7 indicates possibly updating documentation somewhere to resolve this. Either way, I'd like to give it a bit more time to sit and stew.
Comment 9 Autocracy 2009-05-12 02:37:47 UTC
Created attachment 6109 [details]
Changes to Preferences.php and DefaultSettings.php against trunk@50475

Not yet tested, but it's a similar pattern to what's setup for wgAllowRealName. I suppose I'll refire my VM at some point this week if nobody else closes this bug.
Comment 10 Autocracy 2009-05-12 12:53:04 UTC
Patch was tested and does work.
Comment 11 Chad H. 2009-05-17 00:26:23 UTC
Created attachment 6126 [details]
Implement $wgHiddenPrefs

Here's a patch to make an array of prefs to hide from users. Still not sure if it's worth committing.

Obsoleting the previous patch because yet-another-global to change a single preference is a bad idea, IMHO, per my comment 4.
Comment 12 Aryeh Gregor (not reading bugmail, please e-mail directly) 2009-05-17 13:56:20 UTC
$wgHiddenPrefs sounds like a good idea.  Generally I don't have a problem with adding more config variables, within the bounds of sanity.  The overhead is pretty minimal, and usually when doing support we ask the person to paste their LocalSettings anyway.  It's reasonable that some sites won't want to ask users their genders, and this is a nice general way to handle that.
Comment 13 Siebrand Mazeland 2009-05-17 14:10:17 UTC
Updated summary. From "Allow not asking users their gender" to "Add setting to hide a list of preferences"
Comment 14 Dan Jacobson 2009-05-18 21:32:52 UTC
OK, split off Bug 18841 to only ask gender if it will indeed be used, etc.
Comment 15 Tim Starling 2009-05-19 06:23:57 UTC
I recommend committing the patch for release in 1.16, but note that $wgAllowRealName needs to stay in DefaultSettings.php marked as deprecated, to avoid a register_globals vulnerability. There should be no isset(). 

To say it isn't needed, when Jidanni has an example of a wiki about transgender issues in a language lacking grammatical genders, is a bit bizarre. The question would cause offence regardless of how long the explanation is. I would suggest that Jidanni patches this change in if he needs to run 1.15. 
Comment 16 Brion Vibber 2009-05-19 16:42:09 UTC
Looks good to me; as Tim notes a default setting of $wgAllowRealName needs to be retained. Always set your globals before use. :)
Comment 17 Chad H. 2009-05-19 17:09:28 UTC
Applied modified patch in r50782
Comment 18 Dan Jacobson 2009-05-20 01:19:16 UTC
Created attachment 6137 [details]
Better comment
Comment 19 Aryeh Gregor (not reading bugmail, please e-mail directly) 2009-05-20 14:30:58 UTC
Comment improved in r50822.
Comment 20 Robin Pepermans (SPQRobin) 2009-05-24 12:16:02 UTC
$wgAllowRealName was not removed everywhere, so I replaced them by $wgHiddenPrefs, and I made $wgAllowUserSkin obsolete, because it's also replaced by $wgHiddenPrefs. (r50782)

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


Navigation
Links