| We hope you enjoy your visit. You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free. Join our community! If you're already a member please log in to your account to access all of our features: |
| Template: how to identify logged-in users? | |
|---|---|
| Tweet Topic Started: Sep 4 2011, 10:42 PM (531 Views) | |
| Reera_the_Red | Sep 4 2011, 10:42 PM Post #1 |
|
Member
![]() ![]() ![]()
|
I have a piece of Javascript code that I wish to execute on my board only for logged-in users -- i.e., it should not execute on the log-in screen, so non-members wouldn't see the effects. This was easy on my InvisionFree board; there's a "userid" cookie that I could check which was absent or zero if a user was not logged in. Unfortunately, on my Zetaboards board, there is no clear equivalent that I can use. There is a cookie which seems to indicate an active session (its name is my board's number followed by "sess", and it goes away when I log out), but it's apparently protected, as I cannot read it via document.cookies. So -- is there some way that my Javascript code that I'm placing in the board template can determine whether a user is logged in? |
![]() |
|
| Nicolas | Sep 4 2011, 11:40 PM Post #2 |
|
"PLES RING IF AN RNSER IS REQIRD."
![]()
|
Sure. ![]() You can do something simple like this: You can find a lot more help with things like these on our Official Resource Board. |
![]() |
|
| Reera_the_Red | Sep 4 2011, 11:58 PM Post #3 |
|
Member
![]() ![]() ![]()
|
Sure enough. Silly of me not to have thought of that; thanks! And that will also solve another little puzzle I was trying to work out. I'll check the Resource Board; thanks for the pointer. I've had my InvisionFree board for several years, but the Zetaboards one is new and I'm still scouting out the possibilities. |
![]() |
|
| Quozzo-ZNS | Sep 8 2011, 07:55 PM Post #4 |
![]()
Member
![]() ![]() ![]() ![]()
|
i prefere this:
it has no distinct advantage other than being shorter, and maybe a fraction of a second quicker for the browser too, not that anyone could notice such a thing, but it does add up. |
![]() |
|
| 1 user reading this topic (1 Guest and 0 Anonymous) | |
| « Previous Topic · ZetaBoards - Theme & Code Support · Next Topic » |





![]](http://z1.ifrm.com/static/1/pip_r.png)






8:41 PM Jul 10