diff options
author | Zach Copley <zach@status.net> | 2010-11-17 21:53:56 +0000 |
---|---|---|
committer | Zach Copley <zach@status.net> | 2010-11-17 21:53:56 +0000 |
commit | 2c68703923e94a27376622d96a1d5481807bfbf6 (patch) | |
tree | edfb594b1bfb136eeef86eb958e622621867713e /plugins/FacebookBridge/FacebookBridgePlugin.php | |
parent | 64a29bd401bb7f38e174a6529c062dd3c20bfe5b (diff) |
Facebook: Gracefully handle disconnection
Diffstat (limited to 'plugins/FacebookBridge/FacebookBridgePlugin.php')
-rw-r--r-- | plugins/FacebookBridge/FacebookBridgePlugin.php | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/plugins/FacebookBridge/FacebookBridgePlugin.php b/plugins/FacebookBridge/FacebookBridgePlugin.php index c30ea1544..93427d5bd 100644 --- a/plugins/FacebookBridge/FacebookBridgePlugin.php +++ b/plugins/FacebookBridge/FacebookBridgePlugin.php @@ -236,7 +236,8 @@ class FacebookBridgePlugin extends Plugin } /* - * Add a tab for user-level Facebook settings + * Add a tab for user-level Facebook settings if the user + * has a link to Facebook * * @param Action &action the current action * @@ -247,17 +248,32 @@ class FacebookBridgePlugin extends Plugin if ($this->hasApplication()) { $action_name = $action->trimmed('action'); - $action->menuItem( - common_local_url('facebooksettings'), - // TRANS: Menu item tab. - _m('MENU','Facebook'), - // TRANS: Tooltip for menu item "Facebook". - _m('Facebook settings'), - $action_name === 'facebooksettings' - ); + // CurrentUserDesignAction stores the current user in $cur + $user = $action->getCurrentUser(); + + $flink = null; + + if (!empty($user)) { + $flink = Foreign_link::getByUserID( + $user->id, + FACEBOOK_SERVICE + ); + } + + if (!empty($flink)) { + + $action->menuItem( + common_local_url('facebooksettings'), + // TRANS: Menu item tab. + _m('MENU','Facebook'), + // TRANS: Tooltip for menu item "Facebook". + _m('Facebook settings'), + $action_name === 'facebooksettings' + ); + + } } - return true; } /* |