public function loginCustomer($email, $password, $remember = false) { $customer = CI::db()->where('is_guest', 0)->where('email', $email)->where('active', 1)->where('password', $password)->limit(1)->get('customers')->row(); if ($customer && !(bool) $customer->is_guest) { // Set up any group discount if ($customer->group_id != 0) { $group = CI::Customers()->get_group($customer->group_id); if ($group) { $customer->group = $group; } } if ($remember) { $loginCred = json_encode(array('email' => $customer->email, 'password' => $customer->password)); $loginCred = base64_encode($this->aes256Encrypt($loginCred)); //remember the user for 6 months $this->generateCookie($loginCred, strtotime('+6 months')); } //combine cart items if ($this->customer()) { $oldCustomer = $this->customer(); CI::session()->set_userdata('customer', $customer); \GC::combineCart($oldCustomer); // send the logged-in customer data } return true; } else { return false; } }