Skip to content

Commit

Permalink
Merge pull request #17 from REJack/patch-1
Browse files Browse the repository at this point in the history
inserted get_user_var_keys function
  • Loading branch information
Emre Akay committed Aug 16, 2014
2 parents cbda008 + bd75de2 commit 8f93f7f
Showing 1 changed file with 48 additions and 1 deletion.
49 changes: 48 additions & 1 deletion application/libraries/Aauth.php
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ public function reset_password($user_id, $ver_code){
$query = $this->CI->db->where('verification_code', $ver_code);
$query = $this->CI->db->get( $this->config_vars['users'] );

$pass = random_string('alphanum',8);
$pass = random_string('alnum',8);

if( $query->num_rows() > 0 ){

Expand Down Expand Up @@ -1781,6 +1781,37 @@ public function get_user_var( $key, $user_id = false){
}

}


/**
* List User Variable Keys by UserID
* Return array of variable keys or false
* @param int $user_id ; if not given current user
* @return bool|string , false if var is not set, the value of var if set
*/
public function list_user_var_keys($user_id = false){

if ( ! $user_id ){
$user_id = $this->CI->session->userdata('id');
}

// if specified user is not found
if ( ! $this->get_user($user_id)){
return false;
}
$query = $this->CI->db->select('key');

$query = $this->CI->db->where('user_id', $user_id);

$query = $this->CI->db->get( $this->config_vars['user_variables'] );

// if variable not set
if ($query->num_rows() < 1) { return false;}
else {
return $query->result();
}

}

########################
# Aauth System Variables
Expand Down Expand Up @@ -1857,6 +1888,22 @@ public function get_system_var( $key ){
return $row->value;
}
}

/**
* List System Variable Keys
* Return array of variable keys or false
* @return bool|array , false if var is not set, the value of var if set
*/

public function list_system_var_keys(){
$query = $this->CI->db->select('key');
$query = $this->CI->db->get( $this->config_vars['system_variables'] );
// if variable not set
if ($query->num_rows() < 1) { return false;}
else {
return $query->result();
}
}

} // end class

Expand Down

0 comments on commit 8f93f7f

Please sign in to comment.