View Single Post
  #2  
Old 01-18-2010, 03:05 PM
TheLastSuperman's Avatar
TheLastSuperman TheLastSuperman is offline
Senior Member
 
Join Date: Sep 2008
Location: North Carolina
Posts: 5,844
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quick tips!

1. How 2 Guide - Template Conditionals

A Conditional If Statement simply put will show something to a user based on IF this or IF that SHOW them THIS. Very simple to follow once you initially grasp it so don't let it trick or fool you

Here's an Example:

Code:
<vb:if condition="$show['member']">

This conditional seen above starting with vb:if will only show the code in between the beginning and the end vb:if it is ended by the slash seen below /

</vb:if>
Now if you test this in 4.0 you will only see this code when logged in as a member . How do I put this code somewhere and utilize it like UKBL first mentioned? Well you can edit your forums templates... vBulletin uses a .php file with code in it, a template with the code in it that corresponds to the php file and css in your style vars area to show you every single page in your vBulletin so basically all three (and some other minor things no need to confuse you early on eh?) make the page display and you the forums owner can make it do your bidding!!

You can edit your styles templates by going to AdminCP > Style & Templates > Style Manager

Now I would create a Child Style to test with so you don't mess up your Live sites style...

AdminCP > Style & Templates > Style Manager > Select the style and to the right click the drop down and select "Add Child Style" and leave it all alone except change "Allow User Selection" to NO this way you can tinker with it behind the scenes .

Then You'll see the new style and click the drop down on the right and choose "Edit Templates" now go down and double click "Header" then at the very top type in TESTING 123 hit save & reload then select the style since you can as an admin and in that style at the very top you'll now see TESTING123 in plain old text .

You just edited your first template... now yes your right... you can do that but with all sorts of codes just be careful as some can make the style go on you so it will require a slight learning curve... and conditionals?

Code:
<vb:if condition="$show['guest']">
TESTING 123
</vb:if>
Put that in the Header Template instead...

Now refresh your page (your still logged in as an admin) and now it's gone, it is only showing to visitors or Guests of the forum i.e. non-logged in users .

Edit: Look what I just found https://vborg.vbsupport.ru/showthread.php?t=231525 and special Thanks to BBR-APBT for taking the time to post it up



2. How 2 Guide - Use Facebook ID# OR Name

Revised Code by Steve to show using Facebook ID number and "Vanity" profile name i.e. if you have already selected your custom Facebook URL i.e. mine is no longer a number it is thelastsuperman .

Quote:
Originally Posted by abqtj

I got it to work using your code, and also tweaked it using code in the link you gave to the 3.8 version.

If you want an update, here's what I'm using:

PHP Code:
<vb:if condition="is_member_of($bbuserinfo, 1,2,3,4,5,6,7,9,11,12)">
<
vb:if condition="$post['field6']">
<
a href="http://www.facebook.com/home.php/#/profile.php?id={vb:raw post.field6}&ref=profile">
<
img src="images/misc/facebook.png" alt="My Facebook" style="border-style: none" target="_blank"/></a>
</
vb:if>
</
vb:if>

<
vb:if condition="is_member_of($bbuserinfo, 1,2,3,4,5,6,7,9,11,12)">
<
vb:if condition="$post['field7']">
<
a href="http://www.facebook.com/?ref=home#/{vb:raw post.field7}?ref=profile">
<
img src="images/misc/facebook.png" alt="My Facebook" style="border-style: none" target="_blank"/></a>
</
vb:if>
</
vb:if> 

The second set, with field 7 in it, uses the vanity name instead of the user id.

Thanks again for this mod!!

-Steve
*Full Credit to UKBL so from here on out I need to see THANKS UKBL in your posts if you enjoy it
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01177 seconds
  • Memory Usage 1,807KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code
  • (1)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete