Frontend\Modules\Profiles\Engine\Model::deleteSetting PHP Method

deleteSetting() public static method

Delete a setting.
public static deleteSetting ( integer $id, string $name ) : integer
$id integer Profile id.
$name string Setting name.
return integer
    public static function deleteSetting($id, $name)
    {
        return (int) FrontendModel::getContainer()->get('database')->delete('profiles_settings', 'profile_id = ? AND name = ?', array((int) $id, (string) $name));
    }

Usage Example

Example #1
0
 /**
  * Execute the extra.
  */
 public function execute()
 {
     // get activation key
     $key = $this->URL->getParameter(0);
     // load template
     $this->loadTemplate();
     // do we have an activation key?
     if (isset($key)) {
         // get profile id
         $profileId = FrontendProfilesModel::getIdBySetting('activation_key', $key);
         // have id?
         if ($profileId != null) {
             // update status
             FrontendProfilesModel::update($profileId, array('status' => 'active'));
             // delete activation key
             FrontendProfilesModel::deleteSetting($profileId, 'activation_key');
             // login profile
             FrontendProfilesAuthentication::login($profileId);
             // trigger event
             FrontendModel::triggerEvent('Profiles', 'after_activate', array('id' => $profileId));
             // show success message
             $this->tpl->assign('activationSuccess', true);
         } else {
             // failure
             $this->redirect(FrontendNavigation::getURL(404));
         }
     } else {
         $this->redirect(FrontendNavigation::getURL(404));
     }
 }
All Usage Examples Of Frontend\Modules\Profiles\Engine\Model::deleteSetting