Ejemplo n.º 1
0
 /**
  * @param  string $current_password
  * @param  string $new_password
  * @return array
  */
 public function processPasswordChange($current_password, $new_password)
 {
     $rows = $this->db->select('users', array("`password` = '" . $current_password . "'", "`id` = '" . $this->id . "'"));
     $return_array = array();
     if (!$rows) {
         $return_array['status'] = 0;
         $return_array['message'] = 'Incorrect current password.';
     } else {
         $this->db->update('users', array('password' => $new_password), array("`id` = '" . $this->id . "'"));
         $return_array['status'] = 1;
         $return_array['message'] = 'New account password saved.';
     }
     return $return_array;
 }
Ejemplo n.º 2
0
 /**
  * @param  int $id
  * @return int
  */
 public function getIdFromUserId($user_id)
 {
     $rows = $this->db->select('businesses', array("`user_id` = '" . $user_id . "'"));
     if ($rows) {
         return $rows[0]['id'];
     }
 }
Ejemplo n.º 3
0
 /**
  * Insert empty records into business tables.
  *
  * @return void
  */
 public function initializeAccount($id)
 {
     $business_id = $this->db->insert('businesses', array('user_id' => $id, 'created_at' => date('Y-m-d H:i:s')));
     $data = array('business_id' => $business_id, 'created_at' => date('Y-m-d H:i:s'));
     $tables = array('about_page', 'catering_page', 'locations', 'contact_page', 'happy_hour_page', 'homepage_page', 'newsletters', 'social_links');
     foreach ($tables as $table) {
         $this->db->insert($table, $data);
     }
 }