GetSimple Support Forum
Function to check if admin logged in or not? - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: General Questions and Problems (http://get-simple.info/forums/forumdisplay.php?fid=16)
+--- Thread: Function to check if admin logged in or not? (/showthread.php?tid=1569)



Function to check if admin logged in or not? - nvinanda - 2011-04-12

I'm trying to implement "Edit this page" link on each page of my GetSimple site. Since I don't want the visitors to see the same link while surfing, I thought of adding a conditional tag like "if(LOGGED IN )".

Please let me know if there's any function available who can do this task?


Function to check if admin logged in or not? - mvlcek - 2011-04-12

nvinanda Wrote:I'm trying to implement "Edit this page" link on each page of my GetSimple site. Since I don't want the visitors to see the same link while surfing, I thought of adding a conditional tag like "if(LOGGED IN )".

Please let me know if there's any function available who can do this task?

There is already a plugin for this here.
You need to switch on site wide cookies (in gsconfig.php) for such a functionality, however, the site wide cookies are broken in GetSimple 3.0 - see workaround in I18N CustomFields plugin.


Function to check if admin logged in or not? - Connie - 2011-04-12

nvinanda Wrote:I'm trying to implement "Edit this page" link on each page of my GetSimple site. Since I don't want the visitors to see the same link while surfing, I thought of adding a conditional tag like "if(LOGGED IN )".

Please let me know if there's any function available who can do this task?

The Plugin-Description says:
Quote:Allows you to edit pages from website if already logged in to admin console. Save you the time to go to admin->pages tab. Can directly go from the page to edit screen

so what is the problem? Is this not working? Did you test with being logged out?

well:

I checked with GS 3
I uploaded the plugin
it is activated
I am logged in
I open the website in another browser tab but I cannot see any hint "Edit this page" there or in the source code
So I think that this plugin is even more discrete than you want to have it ... it does not do anything ... at least following my checks


Function to check if admin logged in or not? - ccagle8 - 2011-04-12

FYI: i've turned the sitewide cookie ON in 3.1 by default


Function to check if admin logged in or not? - mvlcek - 2011-04-12

Connie Wrote:I open the website in another browser tab but I cannot see any hint "Edit this page" there or in the source code
So I think that this plugin is even more discrete than you want to have it ... it does not do anything ... at least following my checks

See above: you need site wide cookies and those are broken in GetSimple 3.0.


Function to check if admin logged in or not? - Connie - 2011-04-12

mvlcek Wrote:See above: you need site wide cookies and those are broken in GetSimple 3.0.

yes, you are right, I checked whether the constante is defined in the config-file, and it was, but I forgot whether it is functionable in 3.0 or not ...


Function to check if admin logged in or not? - nvinanda - 2011-04-12

Thanks.
I don't want to use an plugin due to some reasons. Would it be possible to get the result using functions.php and template.php in the theme folder?

I read here that it's possible using an browser javascript too, please let me know the javascript to use.


Function to check if admin logged in or not? - nvinanda - 2011-04-12

Finally I developed a small javascript to do the task.
Here it is http://shortbutuseful.com/24/javascript-slug-current-url/
Remember: Use the second script and change "administrator" to"admin".