Welcome Guest, Not a member yet? Register   Sign In
Ion Auth - Lightweight Auth System based on Redux Auth 2

[eluser]Andy78[/eluser]
Has anybody added another table to the users object? For example you have users, groups and meta I want to add a forth table user_profiles and have the fields from this returned in the standard user object. I know it shouldn't be that difficult to this but I'm a bit rusty and tired right now and cant follow the full logic of the library. Is it as simple as adding another join into this function:

Code:
public function get_users($group = false)
    {
        $this->db->select(array(
            $this->tables['users'].'.*',
            $this->tables['groups'].'.name AS `group`',
            $this->tables['groups'].'.description AS group_description'
        ));

        if (!empty($this->columns))
        {
            foreach ($this->columns as $field)
            {
                $this->db->select($this->tables['meta'].'.'. $field);
            }
        }

        $this->db->join($this->tables['meta'], $this->tables['users'].'.id = '.$this->tables['meta'].'.'.$this->meta_join, 'left');
        $this->db->join($this->tables['groups'], $this->tables['users'].'.group_id = '.$this->tables['groups'].'.id', 'left');

        if (is_string($group))
        {
            $this->db->where($this->tables['groups'].'.name', $group);
        }
        else if (is_array($group))
        {
            $this->db->where_in($this->tables['groups'].'.name', $group);
        }

        if (isset($this->ion_auth->_extra_where))
        {
            $this->db->where($this->ion_auth->_extra_where);
        }

        return $this->db->get($this->tables['users']);
    }

I'm not sure how this would fit in with the ion_auth config file and where else in the library id have to take the table into account.

So if anybody else has done this I wouldn't mind an example of your code


Messages In This Thread
Ion Auth - Lightweight Auth System based on Redux Auth 2 - by El Forum - 01-19-2011, 06:40 PM



Theme © iAndrew 2016 - Forum software by © MyBB