예제 #1
0
 /**
  * Find a single user based on a field/value match, including role information.
  *
  * @param string $field The field to match. If 'both', attempt to find a user
  * with the $value field matching either the username or email.
  * @param string $value The value to search for.
  * @param string $type  The type of where clause to create ('and' or 'or').
  *
  * @return boolean|object An object with the user's info, or false on failure.
  */
 public function find_by($field = null, $value = null, $type = 'and')
 {
     return parent::find_by($field, $value, $type);
 }
예제 #2
0
 public function find_by($field = null, $value = null)
 {
     $this->db->join('roles', 'roles.role_id = users.role_id', 'left');
     if ($field == 'both') {
         $field = array('username' => $value, 'email' => $value);
         return parent::find_by($field, null, 'or');
     }
     return parent::find_by($field, $value);
 }
예제 #3
0
 /**
  * Find a single user based on a field/value match, including role information.
  *
  * @param string $field The field to match. If 'both', attempt to find a user
  * with the $value field matching either the username or email.
  * @param string $value The value to search for.
  * @param string $type  The type of where clause to create ('and' or 'or').
  *
  * @return boolean|object An object with the user's info, or false on failure.
  */
 public function find_by($field = null, $value = null, $type = 'and')
 {
     $this->preFind();
     return parent::find_by($field, $value, $type);
 }
예제 #4
0
 /**
  * Locates a single user based on a field/value match, with their role information.
  * If the $field string is 'both', then it will attempt to find the user
  * where their $value field matches either the username or email on record.
  *
  * @access public
  *
  * @param string $field A string with the field to match.
  * @param string $value A string with the value to search for.
  * @param string $type  The type of where clause to create. Either 'and' or 'or'.
  *
  * @return bool|object An object with the user's info, or FALSE on failure.
  */
 public function find_by($field = null, $value = null, $type = 'and')
 {
     if (empty($this->selects)) {
         $this->select($this->table_name . '.*, role_name');
     }
     $this->db->join($this->roles_table, $this->roles_table . '.role_id = ' . $this->table_name . '.role_id', 'left');
     return parent::find_by($field, $value, $type);
 }
예제 #5
0
 public function find_by($field = null, $value = null)
 {
     $this->db->join('news_categories', 'news_categories.id = news_articles.category_id', 'left');
     $this->db->join('news_status', 'news_status.id = news_articles.status_id', 'left');
     if (empty($this->selects)) {
         $this->select($this->table . '.*, category');
     }
     return parent::find_by($field, $value);
 }