Previous Thread
Next Thread
Print Thread
Hop To
Joined: Jan 2007
Posts: 25
N
newbie
newbie
N Offline
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
H
Addict
Addict
H Offline
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
R
Former Developer
Former Developer
R Offline
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:

PHP Code
$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 11: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
N
newbie
newbie
N Offline
Joined: Jan 2007
Posts: 25
It only works as an island insert on the sides and not a forum insert for the time being. frown

(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,299
Likes: 116
UBB.threads Developer
UBB.threads Developer
Joined: Jun 2006
Posts: 16,299
Likes: 116
Look at your code...
Code
>?

Should be
Code
?>


I am a Web Development Contractor, I do not work for UBBCentral. I have provided free User to User Support since the beginning of these support forums.
Do you need Forum Install or Upgrade Services?
Forums: A Gardeners Forum, Scouters World
UBB.threads: UBBWiki, UBB Styles, UBB.Sitemaps
Longtime Supporter & Resident Post-A-Holic
VNC Web Services: Code Modifications, Upgrades, Styling, Coding Services, Disaster Recovery, and more!
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,299
Likes: 116
UBB.threads Developer
UBB.threads Developer
Joined: Jun 2006
Posts: 16,299
Likes: 116
Lol its no problem, and an honest mistake hehe; glad you have it up now though smile


I am a Web Development Contractor, I do not work for UBBCentral. I have provided free User to User Support since the beginning of these support forums.
Do you need Forum Install or Upgrade Services?
Forums: A Gardeners Forum, Scouters World
UBB.threads: UBBWiki, UBB Styles, UBB.Sitemaps
Longtime Supporter & Resident Post-A-Holic
VNC Web Services: Code Modifications, Upgrades, Styling, Coding Services, Disaster Recovery, and more!

Link Copied to Clipboard
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
Bots
by Outdoorking - 04/13/2024 5:08 PM
Can you add html to language files?
by Baldeagle - 04/07/2024 2:41 PM
Do I need to rebuild my database?
by Baldeagle - 04/07/2024 2:58 AM
This is not a bug, but a suggestion
by Baldeagle - 04/05/2024 11:25 PM
spam issues
by ECNet - 03/19/2024 11:45 PM
Who's Online Now
0 members (), 919 guests, and 149 robots.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
Los Angeles
Los Angeles
by isaac, August 6
3D Creations
3D Creations
by JAISP, December 30
Artistic structures
Artistic structures
by isaac, August 29
Stones
Stones
by isaac, August 19
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20230217)