Hopefully a quick one this?
I’m just wondering in an extension how do you check to see if a person is logged in or not? I was thinking of checking the member_id using the $SESS->userdata[‘member_id’] with it returning 0 but unfortunately that would be 0 for the Super Admin so that is out.
Is there any built in way to check to see if a user is logged in or not. I’m not talking about {if logged_in} though as this is for an extension.
Thanks for any help on this.
Best wishes,
Mark
Hi Derek,
Oops sorry I meant to post back to say what a numb-skull I am!! Pretty much after I’d posted that I saw that the admin user is never 0! For some reason I had it stuck in my head that it was but I even had the exp_members table open in front of me whilst I was writing it and had the Super Admin number staring me in the face!!!
Don’t I feel silly now. Funny how something that is wrong can stick in your head. Well that one’s well and truly unstuck now.
Thanks for the post and sorry not to have posted back sooner to have saved you 217 finger movements!! 😊
Thanks for the extra information though. Now to get on with the extension I’m trying to make.
Hope you’re having a great weekend. I’m currently writing a piano piece which I’ll probably turn into a song with the help of my fantastic singer of a Wife whilst writing the extension. Who says men can’t multi-task!! 😊
Best wishes,
Mark
You may have already seen it but the extension is now online - Unregistered Comment. Hopefully I’ve not done anything silly with it, just wanted it to be a nice quick way to do what it does and hopefully it is all safe in what I have done?
There’s also a related Feature Request that goes with this one 😉
Had a few people Tweeting about it and contacting me about it being a feature request so thought I’d go ahead and ask even though it was more their idea than mine 😉
Best wishes,
Mark
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.