r49874 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r49873‎ | r49874 | r49875 >
Date:14:16, 25 April 2009
Author:ialex
Status:deferred
Tags:
Comment:
* (bug 18583) Added default values for new preferences so that it doesn't break when there's no user-specific value
* Fixed some preferences names
Modified paths:
  • /trunk/extensions/OnlineStatus/OnlineStatus.php (modified) (history)

Diff [purge]

Index: trunk/extensions/OnlineStatus/OnlineStatus.php
@@ -27,6 +27,15 @@
2828 */
2929 $wgAllowAnyUserOnlineStatusFunction = true;
3030
 31+/**
 32+ * New preferences for this extension
 33+ */
 34+$wgDefaultUserOptions['online'] = 'online';
 35+$wgDefaultUserOptions['showonline'] = 0;
 36+$wgDefaultUserOptions['onlineonlogin'] = 1;
 37+$wgDefaultUserOptions['offlineonlogout'] = 1;
 38+
 39+
3140 // FIXME: Should be a separate class file
3241 class OnlineStatus {
3342
@@ -226,14 +235,14 @@
227236 $radios[wfMsg( 'onlinestatus-toggle-' . $lev )] = $lev;
228237 }
229238
230 - $preferences['onlinestatusonlogin'] =
 239+ $preferences['onlineonlogin'] =
231240 array(
232241 'type' => 'toggle',
233242 'section' => 'misc',
234243 'label-message' => 'onlinestatus-pref-onlineonlogin',
235244 );
236245
237 - $preferences['onlinestatusonlogoff'] =
 246+ $preferences['offlineonlogout'] =
238247 array(
239248 'type' => 'toggle',
240249 'section' => 'misc',
@@ -263,7 +272,7 @@
264273 * Hook for UserLoginComplete
265274 */
266275 static function UserLoginComplete( $user ){
267 - if( $user->getOption( 'offlineonlogout' ) ){
 276+ if( $user->getOption( 'onlineonlogin' ) ){
268277 $user->setOption( 'online', 'online' );
269278 $user->saveSettings();
270279 }

Status & tagging log