summaryrefslogtreecommitdiff
path: root/plugins/TwitterBridge/twitterauthorization.php
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/TwitterBridge/twitterauthorization.php')
-rw-r--r--plugins/TwitterBridge/twitterauthorization.php13
1 files changed, 12 insertions, 1 deletions
diff --git a/plugins/TwitterBridge/twitterauthorization.php b/plugins/TwitterBridge/twitterauthorization.php
index cabf69d7a..bce679622 100644
--- a/plugins/TwitterBridge/twitterauthorization.php
+++ b/plugins/TwitterBridge/twitterauthorization.php
@@ -273,7 +273,13 @@ class TwitterauthorizationAction extends Action
$flink->user_id = $user_id;
$flink->service = TWITTER_SERVICE;
- $flink->delete(); // delete stale flink, if any
+
+ // delete stale flink, if any
+ $result = $flink->find(true);
+
+ if (!empty($result)) {
+ $flink->delete();
+ }
$flink->user_id = $user_id;
$flink->foreign_id = $twuid;
@@ -455,6 +461,11 @@ class TwitterauthorizationAction extends Action
$user = User::register($args);
+ if (empty($user)) {
+ $this->serverError(_('Error registering user.'));
+ return;
+ }
+
$result = $this->saveForeignLink($user->id,
$this->twuid,
$this->access_token);