/** * Activate User by id. * * @access public * @param string $userId [User's hash id] * @return bool */ public function activate($userId) { $bind = array(); $where = ''; $status = false; try { if (!is_null($userId)) { $where = 'WHERE `hash_id` = ?'; $bind[] = $userId; } else { //Log warning message Noobh_Log::warning(__CLASS__ . '::' . __FUNCTION__ . ' Missing Argument userid'); } if (isset($where) && isset($bind)) { if (empty($this->_dbAdapter)) { $this->_dbAdapter = new Noobh_DB_Adapter(); } $sql = 'UPDATE us_user SET is_active = 1 ' . $where; $statement = $this->_dbAdapter->query($sql, $bind); //Log debug message Noobh_Log::debug(__CLASS__ . '::' . __FUNCTION__ . ' Completed executing Sql Query - ' . $sql); $status = true; //Log info Noobh_Log::info(__CLASS__ . '::' . __FUNCTION__ . ' Activated user with id : ' . $userId); } } catch (Exception $ex) { $this->_errorStack->push(self::VALIDATION_TYPE, 920, $this->_errorList[920]); //Log fatal error Noobh_Log::fatal(__CLASS__ . '::' . __FUNCTION__ . ' User activate failed for id: ' . $userId . ' , Error code ' . $ex->getCode() . ' , Error Message ' . $ex->getMessage()); throw new $ex(); } return $status; }
/** * Update user address by address id. * * @access private * @param void * @return bool */ private function _update() { try { $bind = array($this->_address1, $this->_address2, $this->_zipCode, $this->_country, $this->_mobileNumber, $this->_homeNumber); //update based on id $sql = 'UPDATE um_address SET address1 = ?, address2 = ?,zip = ?, country = ?, mobile_phone = ?, home_phone = ?' . " WHERE id = {$this->_id}"; $this->_dbAdapter->query($sql, $bind); //Log debug message Noobh_Log::debug(__CLASS__ . '::' . __FUNCTION__ . 'Completed executing Sql Query - ' . $sql); //Log info Noobh_Log::info(__CLASS__ . '::' . __FUNCTION__ . 'Updated user address with id : ' . $this->_id); } catch (Exception $ex) { $this->_errorStack->push(self::VALIDATION_TYPE, 911, $this->_errorList[911]); //Log fatal error Noobh_Log::fatal(__CLASS__ . '::' . __FUNCTION__ . ' User address update failed for id: ' . $this->_id . ' , Error code ' . $ex->getCode() . ' , Error Message ' . $ex->getMessage()); } }