diff options
author | Evan Prodromou <evan@controlyourself.ca> | 2009-06-06 09:55:17 -0700 |
---|---|---|
committer | Evan Prodromou <evan@controlyourself.ca> | 2009-06-06 09:55:17 -0700 |
commit | 038cd8ac2545dfbca5ae747a0ffaf370b2861cf2 (patch) | |
tree | c358f67bb6adecf62e1b9caea9b1fa06c62d5c09 /lib/twitterapi.php | |
parent | d15fdac3d348eda7314a206c2403494e9a096c98 (diff) | |
parent | 6658e2a2ee9517bebd59cf69d7483e6eda691b4e (diff) |
Merge branch '0.7.x' of git@gitorious.org:+laconica-developers/laconica/dev into 0.7.x
Diffstat (limited to 'lib/twitterapi.php')
-rw-r--r-- | lib/twitterapi.php | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/twitterapi.php b/lib/twitterapi.php index 1d527b935..ca8b03cdc 100644 --- a/lib/twitterapi.php +++ b/lib/twitterapi.php @@ -673,7 +673,27 @@ class TwitterapiAction extends Action function get_user($id, $apidata=null) { if (!$id) { - return $apidata['user']; + + // Twitter supports these other ways of passing the user ID + if (is_numeric($this->arg('id'))) { + return User::staticGet($this->arg('id')); + } else if ($this->arg('id')) { + $nickname = common_canonical_nickname($this->arg('id')); + return User::staticGet('nickname', $nickname); + } else if ($this->arg('user_id')) { + // This is to ensure that a non-numeric user_id still + // overrides screen_name even if it doesn't get used + if (is_numeric($this->arg('user_id'))) { + return User::staticGet('id', $this->arg('user_id')); + } + } else if ($this->arg('screen_name')) { + $nickname = common_canonical_nickname($this->arg('screen_name')); + return User::staticGet('nickname', $nickname); + } else { + // Fall back to trying the currently authenticated user + return $apidata['user']; + } + } else if (is_numeric($id)) { return User::staticGet($id); } else { |