vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Show HTML only to logged in members? (https://vborg.vbsupport.ru/showthread.php?t=191329)

CBrown 09-19-2008 02:26 PM

Show HTML only to logged in members?
 
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:
Code:

<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

Quote:

Originally Posted by Dismounted (Post 1625674)
In your footer template, add this:
Code:

<if condition="!$show['guest']">HELLO WORLD</if>

Dismounted, what is the difference between doing it that way, and doing it this way:
Code:

<if condition="$show['member']">HELLO WORLD</if>

Dismounted 09-19-2008 02:56 PM

Quote:

Originally Posted by CBrown (Post 1625677)
Really? That easy? Wow.. I have been doing this the hard way.

Thanks!

Yes, it's that easy. :)
Quote:

Originally Posted by Lynne (Post 1625685)
Dismounted, what is the difference between doing it that way, and doing it this way:
Code:

<if condition="$show['member']">HELLO WORLD</if>

None. Lines 499-508 in global.php (3.7.3 PL1).
PHP Code:

if (!$vbulletin->userinfo['userid'] OR $loggedout)
{
    
$show['guest'] = true;
    
$show['member'] = false;
}
else
{
    
$show['guest'] = false;
    
$show['member'] = true;




All times are GMT. The time now is 05:57 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00963 seconds
  • Memory Usage 1,724KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (1)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete