]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/TwitterBridge/twitter.php
Use static class method for looking up Twitter user
[quix0rs-gnu-social.git] / plugins / TwitterBridge / twitter.php
index 2a075300f2f9b6418de2db350a55b5d4e3695f1d..e5afde62ca728771af2432038681a42d0e0704ab 100644 (file)
@@ -28,15 +28,11 @@ require_once INSTALLDIR . '/plugins/TwitterBridge/twitteroauthclient.php';
 
 function add_twitter_user($twitter_id, $screen_name)
 {
-    $new_uri = 'http://twitter.com/' . $screen_name;
-
     // Clear out any bad old foreign_users with the new user's legit URL
     // This can happen when users move around or fakester accounts get
     // repoed, and things like that.
 
-    $luser = new Foreign_user();
-    $luser->uri = $new_uri;
-    $luser->service = TWITTER_SERVICE;
+    $luser = Foreign_user::getForeignUser($twitter_id, TWITTER_SERVICE);
     $result = $luser->delete();
 
     if ($result != false) {
@@ -44,11 +40,6 @@ function add_twitter_user($twitter_id, $screen_name)
             "Twitter bridge - removed old Twitter user: $screen_name ($twitter_id).");
     }
 
-    $luser->free();
-    unset($luser);
-
-    // Otherwise, create a new Twitter user
-
     $fuser = new Foreign_user();
 
     $fuser->nickname = $screen_name;