- function saveForeignLink($access_token, $twitter_user)
- {
- $user = common_current_user();
-
- $flink = new Foreign_link();
-
- $flink->user_id = $user->id;
- $flink->foreign_id = $twitter_user->id;
- $flink->service = TWITTER_SERVICE;
-
- $creds = TwitterOAuthClient::packToken($access_token);
-
- $flink->credentials = $creds;
- $flink->created = common_sql_now();
-
- // Defaults: noticesync on, everything else off
-
- $flink->set_flags(true, false, false, false);
-
- $flink_id = $flink->insert();
-
- if (empty($flink_id)) {
- common_log_db_error($flink, 'INSERT', __FILE__);
- $this->serverError(_m('Couldn\'t link your Twitter account.'));
- }
-
- save_twitter_user($twitter_user->id, $twitter_user->screen_name);
- }
-
- function flinkUser($user_id, $twuid)