PDA

View Full Version : Show HTML only to logged in members?


CBrown
09-19-2008, 02:26 PM
I'm completely new at PHP... I've been using a perl hack I wrote that reads the vb database in perl so I can write code that I know.

Time to learn... So let's start with the basics please...

How do I show HTML code only to logged in members?

Now I'm assuming I can not do this via the template area correct? So I'll have to add it to the correct spot?

Let's say I wanted to put "HELLO WORLD", and show it only to the members in the footer. How would I go about doing this?

Thanks for the help in advance, and I'm looking forward to learning this stuff.

Dismounted
09-19-2008, 02:30 PM
In your footer template, add this:
<if condition="!$show['guest']">HELLO WORLD</if>

CBrown
09-19-2008, 02:34 PM
Really? That easy? Wow.. I have been doing this the hard way.

Thanks!

Lynne
09-19-2008, 02:51 PM
In your footer template, add this:
<if condition="!$show['guest']">HELLO WORLD</if>
Dismounted, what is the difference between doing it that way, and doing it this way:
<if condition="$show['member']">HELLO WORLD</if>

Dismounted
09-19-2008, 02:56 PM
Really? That easy? Wow.. I have been doing this the hard way.

Thanks!
Yes, it's that easy. :)
Dismounted, what is the difference between doing it that way, and doing it this way:
<if condition="$show['member']">HELLO WORLD</if>
None. Lines 499-508 in global.php (3.7.3 PL1).
if (!$vbulletin->userinfo['userid'] OR $loggedout)
{
$show['guest'] = true;
$show['member'] = false;
}
else
{
$show['guest'] = false;
$show['member'] = true;
}