Is there a way to get the currently logged in users for a group? I see a method to get the active users but not the logged in users.
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
February 10, 2010 7:00pm
Subscribe [287]#1021 / Jul 30, 2011 4:19am
Is there a way to get the currently logged in users for a group? I see a method to get the active users but not the logged in users.
#1022 / Jul 30, 2011 3:58pm
could you not do
pseudo code not at my pc.
if(ion auth logged in) {
if(group == 'admin'......etc etc etc)
}Sent from Sony Ericsson Xperia Arc
#1023 / Jul 30, 2011 11:04pm
You’d have to do a query against the DB sessions to get currently logged in users.
#1024 / Aug 07, 2011 6:58am
Hi Ben
I’m in the process converting my current project to Ion Auth 2 and I’ve noticed that the ‘get_newest_users()’ function (and others) has been removed.
I had a dig around in the model and found the ‘limit’ and ‘order_by’ functions and had a try at reproducing ‘get_newest_users()’ using:
$this->ion_auth->limit(6);
$this->ion_auth->order_by('created_on', 'desc');
return $this->ion_auth->users()->result();But it returns all users, not just the latest 6.
Any suggestions how I can code this?
Also can I limit it to users of group ‘members’ only? The users() functions doesn’t appear to reference the users_groups table.
Regards
Russ
#1025 / Aug 07, 2011 7:42am
Hi Ben
I’m in the process converting my current project to Ion Auth 2 and I’ve noticed that the ‘get_newest_users()’ function (and others) has been removed.
I had a dig around in the model and found the ‘limit’ and ‘order_by’ functions and had a try at reproducing ‘get_newest_users()’ using:
$this->ion_auth->limit(6); $this->ion_auth->order_by('created_on', 'desc'); return $this->ion_auth->users()->result();But it returns all users, not just the latest 6.
Any suggestions how I can code this?
Also can I limit it to users of group ‘members’ only? The users() functions doesn’t appear to reference the users_groups table.
Regards
Russ
This is simple!
Change the limit to 1 as below and it will filter the latest record only.
$this->ion_auth->limit(1);
$this->ion_auth->order_by('created_on', 'desc');
return $this->ion_auth->users()->result();#1026 / Aug 07, 2011 1:17pm
Thanks for the reply ibbrx,
Why should limit(1) work when limit(6) doesn’t? (and it doesn’t, I still get all users).
Plus I want the 6 latest users, not just the 1
Russ
#1027 / Aug 08, 2011 7:19am
What is the best practice for making the data of an user that has logged in globally accessible? Is there a standard function i missed?
Because now ive just extended the CI_Controller.
#1028 / Aug 12, 2011 3:03pm
Hi,
I want to use Ion Auth 2 for a new project. I’ve set up my basic enviroment. Log in and creating a new user works perfect.
But when I log in and want to go to /change_password an error occurs. The function get_user() does not excist in version 2 or am I missing it?
#1029 / Aug 13, 2011 6:33am
Hi,
I want to use Ion Auth 2 for a new project. I’ve set up my basic enviroment. Log in and creating a new user works perfect.
But when I log in and want to go to /change_password an error occurs. The function get_user() does not excist in version 2 or am I missing it?
I don’t think Ben has had a chance to update the user guide for V2 yet.
The V2 function is user().
#1030 / Aug 13, 2011 2:19pm
Does “ion auth 2” use a different repo or is just what people are calling the code at http://github.com/benedmunds/CodeIgniter-Ion-Auth
If it’s something new I’d be interested in helping test and provide mods if there’s room for another developer.
edit - actually I’m interested in helping out with both but if there’s a successor to ion auth in the works, I’m more interested in helping with that.
#1031 / Aug 13, 2011 10:07pm
michaelh99,
v2 has it’s own branch on github.
#1032 / Aug 14, 2011 10:42am
I’m guessing that since you didn’t reply to the offer of assistance, you aren’t looking for any?
#1033 / Aug 14, 2011 12:12pm
Hi,
I was just wondering whether I would be able to change the hashing routine in my install. Is it just a function in the library or is it scattered all over the place?
Joseph
#1034 / Aug 15, 2011 12:05pm
michaelh99,
Definitely up for assistance. Just send me a pull request for any updates you have.
Thanks!
#1035 / Aug 15, 2011 12:06pm
jszym,
It’s just a method that can be changed easily.