Posts: 25
Threads: 8
Joined: Jul 2010
I like to code a page where i want to enable special things for myself to manipulate data, and of course the public should not have this provileges. I would like getsimpe to check if i am logged in. Is there a way?
It seems like you are never loged in into the normal sites. Just the admin panels if i am right? Maybe there is a plugin for this or some easy way to do that?
Posts: 2,928
Threads: 195
Joined: Feb 2011
why don't you set these pages to "private"? Then non-logged in users don't see them
check the page options ;=)
Cheers, Connie
Posts: 25
Threads: 8
Joined: Jul 2010
2012-03-07, 19:08:43
(This post was last modified: 2012-03-07, 19:09:34 by jarno1982.)
no i dont want to be the pages to be private i want them to show extra forms for the admin (me) to to change mysql entries and stuff. i am working on a small php application
Posts: 2,928
Threads: 195
Joined: Feb 2011
there are filters and hooks which you could use, check the list at the wiki:
http://get-simple.info/wiki/plugins:hooks_filters
maybe you can find something there ;=)
what I can imagine:
1) create a private page
2) create a template for that page, use the filter or hook there
3) create components
4) add these components to the private page
Cheers, Connie
Posts: 25
Threads: 8
Joined: Jul 2010
i said i dont want private pages? you dont get it! (or me?)
whats the diffrence beween a private page and a private page with components on in? if its based on a private page normal users cant see the page and thats NOT what i want!
maybe components on a public page that only show up to admins would be nice but how? it dont even needs to be components. i just want to detect a admin in a public page and include something if a admin is logged in.
Posts: 1,848
Threads: 86
Joined: Aug 2009
i know what you are talking about... sort of the way WordPress includes the 'Edit' link on posts when it detects that it's author is logged in. We do not have a function like that, we should though. It should be easy to do since all you have to do is check for existence of a the GS_ADMIN_USERNAME Cookie.
-
Chris
Thanks for using GetSimple! - Download
Please do not email me directly for help regarding GetSimple. Please post all your questions/problems in the forum!
Posts: 2,928
Threads: 195
Joined: Feb 2011
bugmenot Wrote:whats the diffrence beween a private page and a private page with components on in? if its based on a private page normal users cant see the page and thats NOT what i want!
I am sorry that I bugged you ;=)
well, don't make it private, but do make a template for that page with logic, using template hooks or
components
do as you please ;=)
Cheers, Connie
Posts: 6,266
Threads: 181
Joined: Sep 2011
I think 3.1 has sitewide cookies by default, so you should be able to just read the cookie, or use globals.
Code:
GLOBAL $USR;
if (isset($USR) && $USR == get_cookie('GS_ADMIN_USERNAME')) {
// do stuff
}
Might not be entirely accurate, I only briefly looked into it, I want a working edit this page plugin.
Posts: 3,491
Threads: 106
Joined: Mar 2010
This works with GS 3.1 (but not with 3.0):
Code:
if (cookie_check()=='1') {
// ... logged in
}
@ccagle8, shawn_a
Time ago I made a small plugin for this:
http://get-simple.info/forum/post/6074/#p6074
It works, but it uses its own cookie (that you have to set, once logged).
I intended to update one of these days it to use cookie_check() ...
Posts: 6,266
Threads: 181
Joined: Sep 2011
Carlos Wrote:This works with GS 3.1 (but not with 3.0):
Code:
if (cookie_check()=='1') {
// ... logged in
}
@ccagle8, shawn_a
Time ago I made a small plugin for this: http://get-simple.info/forum/post/6074/#p6074
It works, but it uses its own cookie (that you have to set, once logged).
I intended to update one of these days it to use cookie_check() ...
I couldn't figure out how to get it working. I thought it was borked. Ill try again.
Thanks!
Posts: 3,491
Threads: 106
Joined: Mar 2010
shawn_a Wrote:I couldn't figure out how to get it working. I thought it was borked. Ill try again.
Thanks!
You mean the plugin? There are two, the one I made and linked in that post (not in Extend), and another (not by me) in Extend, which I don't remember if worked with GS 2.x but is surely not compatible with 3.x
Posts: 6,266
Threads: 181
Joined: Sep 2011
Carlos Wrote:This works with GS 3.1 (but not with 3.0):
Code:
if (cookie_check()=='1') {
// ... logged in
}
Won't this return true for any logged in user ? Would my code be better for multi user sites, for checking if user is admin.
EDIT:
hmm i was wrong, you still need to have a default admin account somehow to check against, is there a way to know the default admin account with multi user plugin installed ?