Skip to content

Commit

Permalink
added function get_user_vars($user_id)
Browse files Browse the repository at this point in the history
  • Loading branch information
REJack committed May 11, 2016
1 parent 3887dd4 commit 0ae258d
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions application/libraries/Aauth.php
Original file line number Diff line number Diff line change
Expand Up @@ -2236,6 +2236,33 @@ public function get_user_var( $key, $user_id = FALSE){
}


/**
* Get User Variables by user id
* Return array with all user keys & variables
* @param int $user_id ; if not given current user
* @return bool|array , FALSE if var is not set, the value of var if set
*/
public function get_user_vars( $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->aauth_db->select('data_key, value');

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

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

return $query->result();

}

/**
* List User Variable Keys by UserID
* Return array of variable keys or FALSE
Expand Down

0 comments on commit 0ae258d

Please sign in to comment.