Posts: 290
Threads: 26
Joined: Oct 2010
2010-11-16, 14:30:34
(This post was last modified: 2010-11-16, 15:38:27 by Chastin3.)
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>
Posts: 1,204
Threads: 30
Joined: Jun 2010
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 ?
Addons: blue business theme, Online Visitors, Notepad
Posts: 290
Threads: 26
Joined: Oct 2010
2010-11-17, 06:31:10
(This post was last modified: 2010-11-17, 06:45:07 by Chastin3.)
yojoe Wrote: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 ?
Well, I've looked at a couple of plugins:
http://get-simple.info/forum/post/6074/#p6074
and
http://get-simple.info/extend/plugin/edi...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
Notice: Undefined variable: site_version_no in /public_html/admin/inc/theme_functions.php on line 150
-Rob A>