diff options
author | Zach Copley <zach@status.net> | 2010-07-08 21:17:10 +0000 |
---|---|---|
committer | Zach Copley <zach@status.net> | 2010-07-08 21:17:11 +0000 |
commit | 4c5098cd32599a2c376beaadb43cd9d471477c90 (patch) | |
tree | 20ba24a91f86be71fe1e1d079dbd85f0cee90868 /plugins | |
parent | 7746611f20554c92ad0213de196e880e41c3cc4e (diff) |
Handle the case where a screen name has shifted from one Twitter ID to another
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/TwitterBridge/twitter.php | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/plugins/TwitterBridge/twitter.php b/plugins/TwitterBridge/twitter.php index 896eee2da..306ba2442 100644 --- a/plugins/TwitterBridge/twitter.php +++ b/plugins/TwitterBridge/twitter.php @@ -75,8 +75,6 @@ function save_twitter_user($twitter_id, $screen_name) if (!empty($fuser)) { - $result = true; - // Delete old record if Twitter user changed screen name if ($fuser->nickname != $screen_name) { @@ -88,6 +86,25 @@ function save_twitter_user($twitter_id, $screen_name) $screen_name, $oldname)); } + + } else { + + // Kill any old, invalid records for this screen name + + $fuser = Foreign_user::getByNickname($screen_name, TWITTER_SERVICE); + + if (!empty($fuser)) { + $fuser->delete(); + common_log( + LOG_INFO, + sprintf( + 'Twitter bridge - deteted old record for Twitter ' . + 'screen name "%s" belonging to Twitter ID %d.', + $screen_name, + $fuser->id + ) + ); + } } return add_twitter_user($twitter_id, $screen_name); |