diff options
author | Zach Copley <zach@controlyourself.ca> | 2008-08-26 20:54:44 -0400 |
---|---|---|
committer | Zach Copley <zach@controlyourself.ca> | 2008-08-26 20:54:44 -0400 |
commit | 3cf6cef9b9ef2837b38fb0f11097775fdc1efdee (patch) | |
tree | f144433878d2182dbcf9762bc6a4528400d24a12 /classes | |
parent | 803bdff3f67cce50931ce75dd209883a93a20bd3 (diff) |
Twitter integration - Foreign_user::getForeignUser() to retrieve
Foreign_user by multi-part key: user_id + service
darcs-hash:20080827005444-7b5ce-2b53a2c1a917539248b68f21f94e0f9f5fe810f2.gz
Diffstat (limited to 'classes')
-rw-r--r-- | classes/Foreign_user.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/classes/Foreign_user.php b/classes/Foreign_user.php index 25a6ac979..6dbad9aa2 100644 --- a/classes/Foreign_user.php +++ b/classes/Foreign_user.php @@ -23,6 +23,22 @@ class Foreign_user extends DB_DataObject /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE + function getForeignUser($user_id, $service) { + + $fuser = DB_DataObject::factory('foreign_user'); + $fuser->whereAdd("service = $service"); + $fuser->whereAdd("user_id = $user_id"); + $fuser->limit(1); + + if ($fuser->find()) { + $fuser->fetch(); + return $fuser; + } + + return NULL; + } + + static function save($fields) { extract($fields); |