| Index: trunk/extensions/OnlineStatusBar/OnlineStatusBarHooks.php |
| — | — | @@ -22,14 +22,22 @@ |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | /** |
| | 26 | + * Called everytime when user logout |
| 26 | 27 | * @param $user User |
| 27 | 28 | * @param $inject_html string |
| 28 | 29 | * @param $old_name string |
| 29 | 30 | * @return bool |
| 30 | 31 | */ |
| 31 | 32 | public static function logout( &$user, &$inject_html, $old_name ) { |
| 32 | | - OnlineStatusBar::purge( $old_name ); |
| 33 | | - OnlineStatusBar_StatusCheck::deleteStatus( $old_name ); |
| | 33 | + global $wgOnlineStatusBarDefaultEnabled; |
| | 34 | + // check if user had enabled this feature before we write to db |
| | 35 | + $olduser = User::newFromName( $old_name ); |
| | 36 | + if ( $olduser instanceof User ) { |
| | 37 | + if ( $olduser->getOption( 'OnlineStatusBar_active', $wgOnlineStatusBarDefaultEnabled ) ) { |
| | 38 | + OnlineStatusBar::purge( $old_name ); |
| | 39 | + OnlineStatusBar_StatusCheck::deleteStatus( $old_name ); |
| | 40 | + } |
| | 41 | + } |
| 34 | 42 | return true; |
| 35 | 43 | } |
| 36 | 44 | |