public function activate()
    {
        if ($this->status == self::STATUS_REGISTERED) {
            $transaction = static::getDb()->beginTransaction();
            try {
                $this->removeActivationToken();
                $this->status = self::STATUS_ACTIVE;
                if (!$this->save()) {
                    throw new Exception('User saving error!');
                }
                if (!Podium::getInstance()->rbac->assign(Podium::getInstance()->rbac->getRole(Rbac::ROLE_USER), $this->id)) {
                    throw new Exception('User role assigning error!');
                }
                $transaction->commit();
                return true;
            } catch (Exception $e) {
                $transaction->rollBack();
                Log::error($e->getMessage(), null, __METHOD__);
            }
        }
        return false;
    }
public function activate()
    {
        if ($this->status == self::STATUS_REGISTERED) {
            $transaction = static::getDb()->beginTransaction();
            try {
                $this->removeActivationToken();
                $this->status = self::STATUS_ACTIVE;
                if (!$this->save()) {
                    throw new Exception('User saving error!');
                }
                if (!Podium::getInstance()->rbac->assign(Podium::getInstance()->rbac->getRole(Rbac::ROLE_USER), $this->id)) {
                    throw new Exception('User role assigning error!');
                }
                $transaction->commit();
                return true;
            } catch (Exception $e) {
                $transaction->rollBack();
                Log::error($e->getMessage(), null, __METHOD__);
            }
        }
        return false;
    }
public function activate ( ) { if ( $ this -> status == self :: STATUS_REGISTERED ) { $ transaction = static :: getDb ( ) -> beginTransaction ( ) ; try { $ this -> removeActivationToken ( ) ; $ this -> status = self :: STATUS_ACTIVE ; if ( ! $ this -> save ( ) ) { throw new Exception ( 'User saving error!' ) ; } if ( ! Podium :: getInstance ( ) -> rbac -> assign ( Podium :: getInstance ( ) -> rbac -> getRole ( Rbac :: ROLE_USER ) , $ this -> id ) ) { throw new Exception ( 'User role assigning error!' ) ; } $ transaction -> commit ( ) ; return true ; } catch ( Exception $ e ) { $ transaction -> rollBack ( ) ; Log :: error ( $ e -> getMessage ( ) , null , __METHOD__ ) ; } } return false ; }
Activates account.
@return bool
Activates account .