Hello fellow MediaWiki sysops,
Does anyone know where in http://www.MediaWiki.org/ - failing that, please share your experience here - we can find where and how to change defaults for user preferences so that subsequent users get the new defaults?
Is there a way to change defaults for preferences for even all users, including existing users? There are endless references to users changing their own preferences, but how to setup initial preferences?
For instance, in the user preferences under [Search] I want to engage ALL namespaces. I see the first is checked: [ x ] (main) ... but a search for "(main)" in the contents of all files in the mediawiki directory tree returns nothing! So where do we look to control these choices globally?
Thanks!
I believe you have to do this in two steps:
1. Set up default preferences for all NEW users (who have never logged in yet)
This is done in LocalSettings.php by setting $wgNamespacesToBeSearchedDefault. For example:
# Choose the namespaces $myAdditionalNamespacesSearchDefault = array( NS_MAIN, NS_TALK, NS_USER, NS_USER_TALK, NS_PROJECT, NS_PROJECT_TALK, NS_IMAGE, NS_IMAGE_TALK, NS_MEDIAWIKI, NS_MEDIAWIKI_TALK, NS_TEMPLATE, NS_TEMPLATE_TALK, NS_HELP, NS_HELP_TALK, NS_CATEGORY, NS_CATEGORY_TALK ); foreach ($myAdditionalNamespacesSearchDefault as $value) { $wgNamespacesToBeSearchedDefault[$value] = true; }
2. Setting default preferences for all EXISTING users
This is done in the database in the user table. For example:
UPDATE YOUR_PREFIX_user SET user_options = REPLACE(user_options, 'searchNs1=0', 'searchNs1=1'); UPDATE YOUR_PREFIX_user SET user_options = REPLACE(user_options, 'searchNs2=0', 'searchNs2=1'); UPDATE YOUR_PREFIX_user SET user_options = REPLACE(user_options, 'searchNs3=0', 'searchNs3=1'); UPDATE YOUR_PREFIX_user SET user_options = REPLACE(user_options, 'searchNs4=0', 'searchNs4=1'); UPDATE YOUR_PREFIX_user SET user_options = REPLACE(user_options, 'searchNs5=0', 'searchNs5=1'); UPDATE YOUR_PREFIX_user SET user_options = REPLACE(user_options, 'searchNs6=0', 'searchNs6=1'); UPDATE YOUR_PREFIX_user SET user_options = REPLACE(user_options, 'searchNs7=0', 'searchNs7=1'); UPDATE YOUR_PREFIX_user SET user_options = REPLACE(user_options, 'searchNs8=0', 'searchNs8=1'); UPDATE YOUR_PREFIX_user SET user_options = REPLACE(user_options, 'searchNs9=0', 'searchNs9=1'); UPDATE YOUR_PREFIX_user SET user_options = REPLACE(user_options, 'searchNs10=0', 'searchNs10=1'); UPDATE YOUR_PREFIX_user SET user_options = REPLACE(user_options, 'searchNs11=0', 'searchNs11=1'); UPDATE YOUR_PREFIX_user SET user_options = REPLACE(user_options, 'searchNs12=0', 'searchNs12=1'); UPDATE YOUR_PREFIX_user SET user_options = REPLACE(user_options, 'searchNs13=0', 'searchNs13=1'); UPDATE YOUR_PREFIX_user SET user_options = REPLACE(user_options, 'searchNs14=0', 'searchNs14=1'); UPDATE YOUR_PREFIX_user SET user_options = REPLACE(user_options, 'searchNs15=0', 'searchNs15=1');
where "YOUR_PREFIX_" is whatever database table prefix is used for your wiki.
DanB
And if you need to designate new, custom namespaces for searching, the easiest way seems to be the script maintenance/userOptions.php. For example, to enable search on custom namespace 200 for all users:
cd maintenance php userOptions.php searchNs200 --old "" --new 1
or if you are enabling rather than creating:
php userOptions.php searchNs200 --old 0 --new 1
DanB
-----Original Message----- 2. Setting default preferences for all EXISTING users This is done in the database in the user table...
mediawiki-l@lists.wikimedia.org