/** * Handles a request to save preferences * * Validates input and, if everything is OK, deletes the OpenID. * Reloads the form with a success or error notification. * * @return void */ function savePrefs() { $orig = null; $prefs = User_openid_prefs::getKV('user_id', $this->scoped->getID()); if (!$prefs instanceof User_openid_prefs) { $prefs = new User_openid_prefs(); $prefs->user_id = $this->scoped->getID(); $prefs->created = common_sql_now(); } else { $orig = clone $prefs; } $prefs->hide_profile_link = $this->booleanintstring('hide_profile_link'); if ($orig instanceof User_openid_prefs) { $prefs->update($orig); } else { $prefs->insert(); } return _m('OpenID preferences saved.'); }
/** * Handles a request to save preferences * * Validates input and, if everything is OK, deletes the OpenID. * Reloads the form with a success or error notification. * * @return void */ function savePrefs() { $cur = common_current_user(); if (empty($cur)) { throw new ClientException(_("Not logged in.")); } $orig = null; $prefs = User_openid_prefs::getKV('user_id', $cur->id); if (empty($prefs)) { $prefs = new User_openid_prefs(); $prefs->user_id = $cur->id; $prefs->created = common_sql_now(); } else { $orig = clone $prefs; } $prefs->hide_profile_link = $this->booleanintstring('hide_profile_link'); if (empty($orig)) { $prefs->insert(); } else { $prefs->update($orig); } $this->showForm(_m('OpenID preferences saved.'), true); return; }