Check for logged in user - Printable Version +- GetSimple Support Forum (http://get-simple.info/forums) +-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3) +--- Forum: Developer Discussions (http://get-simple.info/forums/forumdisplay.php?fid=8) +--- Thread: Check for logged in user (/showthread.php?tid=1129) |
Check for logged in user - RobA - 2010-11-16 Is there a simple way/call for a plugin to know if there is an active logged session? I wanted to set my simplecache plugin to not show cached pages to a logged in user. Thanks in advance- EDIT: nvm I was checking the source and it look like I just need to call cookie_check(); EDIT: Nope - thought I could just throw in a Code: include_once(GSADMININCPATH.'cookie_functions.php'); and then use an if(cookie_check()==FALSE) to check for no user logged in, but that isn;t working -Rob A> Check for logged in user - yojoe - 2010-11-16 You'd have to use isset to check if a cookie exist, rather than checking boolean value of cookie_check() function. Anyway, you won't check it without knowing name of the cookie, and it's not that simple, as the name contains the salt value. Something like: getsimple_cookie_203rwzy^|epaw*ekf7zuj2m3o4ga3o~fw5tbatt Maybe just looking if a cookie starting with "getsimple_cookie_" chars exist and is not null would be enough ? Check for logged in user - RobA - 2010-11-17 yojoe Wrote:You'd have to use isset to check if a cookie exist, rather than checking boolean value of cookie_check() function. Well, I've looked at a couple of plugins: http://get-simple.info/forum/post/6074/#p6074 and http://get-simple.info/extend/plugin/edit-this-page-plugin/26/ The first hooks into login/logout and sets/checks its own cookie. The second duplicates some of the stuff in the cookie_check() function. Any guidance on what is better? EDIT: Looks like I can't include configuration.php in the pre and post template hooks, I end up with an error: Code: Notice: Undefined variable: site_full_name in /public_html/admin/inc/theme_functions.php on line 150 -Rob A> |