|
Joined: Jan 2007
Posts: 25
newbie
|
newbie
Joined: Jan 2007
Posts: 25 |
I'd like to only display Custom Island Insert to guests and not signed in members.
How can I do this? I think it'll encourage people to sign up.
|
|
|
|
Joined: Jun 2006
Posts: 684
Addict
|
Addict
Joined: Jun 2006
Posts: 684 |
You need a little snippet of PHP in the insert. I'd like to have the same thing, but I don't know the code.
|
|
|
|
Joined: Jun 2006
Posts: 9,242 Likes: 1
Former Developer
|
Former Developer
Joined: Jun 2006
Posts: 9,242 Likes: 1 |
Currently there isn't a way to only show it if the user is not logged in. However, you can do a bit of php work and make the contents of the box different for those that are logged in compared to those that aren't logged in. You'd use this for the contents: $body = <<<EOF
<?php
if (\$user['USER_DISPLAY_NAME']) {
echo <<<STUFF
This will display for someone who is logged in.
STUFF;
} else {
echo <<<STUFF
This will display for someone who isn't logged in.
STUFF;
}
?>
EOF;
Last edited by Rick; 01/09/2007 10:39 PM.
|
|
|
|
Joined: Jul 2006
Posts: 4,057
|
Joined: Jul 2006
Posts: 4,057 |
Rick could i use somthing simular to validate if a user is logged in or not to view external web pages ?
As i been looking for a solution since 7.00 beta's
As i have web pages that i only want members too see.
Thanks Mark.
BOOM !! Version v7.6.1.1 People who inspire me Isaac ME Gizmo
|
|
|
|
Joined: Oct 2006
Posts: 358
enthusiast
|
enthusiast
Joined: Oct 2006
Posts: 358 |
Rick, If I add your code exactly as you posted, it doesn't work. What did I miss? Thanks.
--BIll B
|
|
|
|
Joined: Jan 2007
Posts: 25
newbie
|
newbie
Joined: Jan 2007
Posts: 25 |
It only works as an island insert on the sides and not a forum insert for the time being. (Also be careful, there's a bug that's stripping out the PHP references in the custom island when you edit it.)
|
|
|
|
Joined: Oct 2006
Posts: 358
enthusiast
|
enthusiast
Joined: Oct 2006
Posts: 358 |
yep...that is whats happening... it strips out the PHP reference. Is there any way to force it to accept it?
--never mind, I got it to save after repeatedly trying it about 4 or 5 times. But now I get an error after activating it on my site. In fact the homepage completely fails to render.
Here's my version of the code: =================================== $body = <<<EOF <?PHP if (\$user['USER_DISPLAY_NAME']) { echo <<<STUFF Thanks for logging in. STUFF; } else { echo <<<STUFF Please login in order to post a note or reply. STUFF; } >? EOF;
--BIll B
|
|
|
|
Joined: Oct 2006
Posts: 358
enthusiast
|
enthusiast
Joined: Oct 2006
Posts: 358 |
Here is the ERROR code: ============================ Parse error: parse error, unexpected '>' in /home/virtual/site40/fst/var/www/html/forum/cache/portal_box_8.php on line 22
--BIll B
|
|
|
|
Joined: Jun 2006
Posts: 16,372 Likes: 129
|
Joined: Jun 2006
Posts: 16,372 Likes: 129 |
Look at your code... Should be
|
|
|
|
Joined: Oct 2006
Posts: 358
enthusiast
|
enthusiast
Joined: Oct 2006
Posts: 358 |
You know... I saw that last night and meant to fix it... but then when I had to save the darn thing four times to get it to accept the <?-p-h-p (without -'s), I forgot about it.
Hey!! It works great now!!! Very cool... I have a lot of people who forget to log in... I might add this to the upper right corner as a reminder.
Thanks Gizmo for taking the time to look it over.. and of course, Rick for posting the original code. I'm starting to feel pretty good about these Islands now!!!
--BIll B
|
|
|
|
Joined: Jun 2006
Posts: 16,372 Likes: 129
|
Joined: Jun 2006
Posts: 16,372 Likes: 129 |
Lol its no problem, and an honest mistake hehe; glad you have it up now though
|
|
|
1 members (mavorg),
180
guests, and
112
robots. |
Key:
Admin,
Global Mod,
Mod
|
|
|
|