public function removeProductFromUserWishLists(User $user, $productId) { if (!$user->loaded()) { return; } $this->pixie->db->query('delete')->table($this->pixie->orm->get('wishListItem')->table, 'wli')->join(array('tbl_products', 'p'), array('wli.product_id', 'p.productID'))->join(array('tbl_wish_list', 'wl'), array('wl.id', 'wli.wish_list_id'))->where('wl.user_id', '=', $user->id())->where('p.productID', '=', $productId)->execute(); }
/** * Attempt to log in a user. * * @param string $login username to log in * @param string $password password to check against * @param boolean $remember enable auto-login * @return boolean */ public function login($login = '', $password = '', $remember = FALSE) { if (empty($password) or !is_string($password) or !is_string($login)) { return FALSE; } $password = $this->hash($password); $user = new User(); $user->login($login, $password); if (!$user->loaded()) { return FALSE; } if (intval($user->Active) === 1 and $user->Password == $password) { if (intval($user->ActiveTo) > 0 and $user->ActiveTo < time()) { return FALSE; } if ($remember === TRUE) { $tokenModel = new User_Token($this->config['cookie_key']); $tokenModel->delete($user->UserID); $tokenModel->UserID = $user->UserID; $tokenModel->Expires = time() + $this->config['lifetime']; $tokenModel->save(); Cookie::set($this->config['cookie_key'], $tokenModel->Token, $this->config['lifetime']); } $this->completeLogin($user); return TRUE; } // Login failed return FALSE; }