Twitter integration - support for new foreign_link table and prefs now save/update
darcs-hash:20080828072205-7b5ce-16510357343f1d9a3acc696f39a28a723005f3a4.gz
This commit is contained in:
@@ -23,11 +23,12 @@ 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');
|
||||
// XXX: This only returns a 1->1 single obj mapping. Change? Or make
|
||||
// a getForeignUsers() that returns more than one? --Zach
|
||||
static function getForeignUser($id, $service) {
|
||||
$fuser = new Foreign_user();
|
||||
$fuser->whereAdd("service = $service");
|
||||
$fuser->whereAdd("user_id = $user_id");
|
||||
$fuser->whereAdd("id = $id");
|
||||
$fuser->limit(1);
|
||||
|
||||
if ($fuser->find()) {
|
||||
@@ -38,29 +39,4 @@ class Foreign_user extends DB_DataObject
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
static function save($fields) {
|
||||
|
||||
extract($fields);
|
||||
|
||||
$fuser = new Foreign_user();
|
||||
|
||||
$fuser->id = $id;
|
||||
$fuser->service = $service;
|
||||
$fuser->uri = $uri;
|
||||
$fuser->nickname = $nickname;
|
||||
$fuser->user_id = $user_id;
|
||||
$fuser->credentials = $credentials;
|
||||
$fuser->created = common_sql_now();
|
||||
|
||||
$result = $fuser->insert();
|
||||
|
||||
if (!$result) {
|
||||
common_log_db_error($fuser, 'INSERT', __FILE__);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return $fuser;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user