Skip to content

Commit

Permalink
changed get_user_groups() (public groups now visible if checked on …
Browse files Browse the repository at this point in the history
…guests)
  • Loading branch information
REJack committed May 14, 2016
1 parent bd33c95 commit f33affc
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions application/libraries/Aauth.php
Original file line number Diff line number Diff line change
Expand Up @@ -1118,14 +1118,16 @@ public function get_user_id($email=FALSE) {
*/
public function get_user_groups($user_id = FALSE){

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

$this->aauth_db->select('*');
$this->aauth_db->from($this->config_vars['user_to_group']);
$this->aauth_db->join($this->config_vars['groups'], "id = group_id");
$this->aauth_db->where('user_id', $user_id);

return $query = $this->aauth_db->get()->result();
if( !$user_id) { $user_id = $this->CI->session->userdata('id'); }
if( !$user_id){
$this->aauth_db->where('name', $this->config_vars['public_group']);
$query = $this->aauth_db->get($this->config_vars['groups']);
}else if($user_id){
$this->aauth_db->join($this->config_vars['groups'], "id = group_id");
$this->aauth_db->where('user_id', $user_id);
$query = $this->aauth_db->get($this->config_vars['user_to_group']);
}
return $query->result();
}

//tested
Expand Down

0 comments on commit f33affc

Please sign in to comment.