+ // User already has a linked Facebook account and shouldn't be here!
+
+ $this->clientError(
+ // TRANS: Client error displayed when trying to connect to a Facebook account that is already linked
+ // TRANS: in the same StatusNet site.
+ _m('There is already a local account linked with that Facebook account.')
+ );
+
+ return;
+ }
+
+ $cur = common_current_user();
+ $flink = Foreign_link::getByUserID($cur->id, FACEBOOK_SERVICE);
+
+ if (!empty($flink)) {
+
+ // There's already a local user linked to this Facebook account.
+
+ $this->clientError(
+ // TRANS: Client error displayed when trying to connect to a Facebook account that is already linked
+ // TRANS: in the same StatusNet site.
+ _m('There is already a local account linked with that Facebook account.')
+ );
+
+ return;