Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 10-20-2006, 08:31 PM
bashy bashy is offline
 
Join Date: Nov 2005
Posts: 2,544
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Need a conditional please?

Hi peeps

I have this code to show some rotating banners/ads

Code:
<p align="center">
<SCRIPT LANGUAGE="Javascript"><!-- 
function banner() { 
}; 
banner = new banner(); 
number = 0; 
 
// bannerArray 
banner[number++] = "<a href='https://www.hosting.bashys-place.com' target='_blank'><img src='http://www.bashys-place.com/images/bashyshosting.jpg' border='1'></a>"
banner[number++] = "<a href='https://www.hosting.bashys-place.com' target='_blank'><img src='http://www.bashys-place.com/images/webhosting.gif' border='1'></a>"
banner[number++] = "<a href='https://www.hosting.bashys-place.com' target='_blank'><img src='http://www.bashys-place.com/images/bashyshosting.jpg' border='1'></a>" 
banner[number++] = "<a href='https://www.hosting.bashys-place.com' target='_blank'><img src='http://www.bashys-place.com/images/webhosting.gif' border='1'></a>"
banner[number++] = "<a href='http://www.credit-busters.co.uk' target='_blank'><img src='http://www.bashys-place.com/images/credit.gif' border='1'></a>"

 
increment = Math.floor(Math.random() * number); 
document.write(banner[increment]); 
//--></SCRIPT>
<br />
<font color="#008000"><b><br>If you wish to advertise here?<br>Please </b></font>
<b><a href="http://www.bashys-place.com/forums/advertise.php">
<font color="#FF0000"><span style="background-color: #FFFF00">View this page</span></font></a></b></p>
Basically, this is shown to all, including guests, I want this so that 1 of my usergroups (VIP) cannot see it and see something else instead.

Can anyone advise please
Reply With Quote
  #2  
Old 10-20-2006, 10:39 PM
peterska2 peterska2 is offline
 
Join Date: Oct 2003
Location: Manchester, UK
Posts: 6,504
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

you would then want to put
Code:
<if condition="is_member_of($user, usergroup id number of your VIP group eg 17)">
The stuff you want your VIP's to see
<else />
before your code and then at the end of your code add
Code:
</if>
Reply With Quote
  #3  
Old 10-21-2006, 02:59 PM
bashy bashy is offline
 
Join Date: Nov 2005
Posts: 2,544
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks KA will try this
Reply With Quote
  #4  
Old 10-30-2006, 05:25 PM
bashy bashy is offline
 
Join Date: Nov 2005
Posts: 2,544
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi KA

How would i create a conditional for 1 or multiple members then?

example:

We have the Moderator Application system installed, We have 1 or 2 members that are repeatedly filling in the application, i would therefore like to be able to add there user ID's to the condtional for the link in the quick links menu, i just aint sure as to the condional to use?
Reply With Quote
  #5  
Old 10-30-2006, 05:32 PM
Adrian Schneider's Avatar
Adrian Schneider Adrian Schneider is offline
 
Join Date: Jul 2004
Posts: 2,528
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Where the userIDs are 1 2 and 3:
Code:
<if condition="in_array($vbulletin->userinfo['userid'], array(1, 2, 3))">...</if>
If you want to check for these userIDs OR staff members, you can use do so
Code:
<if condition="is_member_of($vbulletin->userinfo, 5, 6, 7) or in_array($vbulletin->userinfo['userid'], array(1, 2, 3))">
For your own sanity down the road, I would actually suggest this: global_start
PHP Code:
$moderator_usergroups = array(567);
$moderator_users = array(123);

$show['moderator_app_links'] = (
    
is_member_of($vbulletin->userinfo$moderator_usergroups) or
    
in_array($vbulletin->userinfo['userid'], $moderator_users)
); 
Then use
Code:
<if condition="$show['moderator_app_links']">
in your template because it will be easier to manage without digging through your templates.
Reply With Quote
  #6  
Old 10-30-2006, 05:40 PM
bashy bashy is offline
 
Join Date: Nov 2005
Posts: 2,544
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi Sir

Thannks, i will have a good read of these and see whats what, thanks again

I take it thats a plugin to create?
then just update it as and when?
Reply With Quote
  #7  
Old 10-30-2006, 05:52 PM
Adrian Schneider's Avatar
Adrian Schneider Adrian Schneider is offline
 
Join Date: Jul 2004
Posts: 2,528
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yeah it's a plugin. I'm not sure I understand your question though...
Reply With Quote
  #8  
Old 10-30-2006, 05:59 PM
bashy bashy is offline
 
Join Date: Nov 2005
Posts: 2,544
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I meant just update it with each user that i dont want to see the link?

Actually i have just tried this and the user in question can still see and click the link
heres what i have in the template
Code:
<if condition="$show['moderator_app_links']" <tr><td class="vbmenu_option"><a href="$vboptions[bburl]/modapp.php?$session[sessionurl]">Apply To Be A Mod</a></td></tr></if>
and the plugin i only changed the user ID to 9

Code:
$moderator_usergroups = array(5, 6, 7);
$moderator_users = array(9);

$show['moderator_app_links'] = (
    is_member_of($vbulletin->userinfo, $moderator_usergroups) or
    in_array($vbulletin->userinfo['userid'], $moderator_users)
);
Ah....just realised, this is the wrong way round, where i have user ID 9 this is the user ID that i DONT want to be able to see the link, allthe rest can see, but as it is atm is that is the only user apart from the staff that can see it lol
What do i do to turn it round please?
Reply With Quote
  #9  
Old 10-30-2006, 06:24 PM
Adrian Schneider's Avatar
Adrian Schneider Adrian Schneider is offline
 
Join Date: Jul 2004
Posts: 2,528
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

lol
PHP Code:
$moderator_usergroups = array(567);
$ignore_users = array(9);

$show['moderator_app_links'] = (
    
is_member_of($vbulletin->userinfo$moderator_usergroups) and
    !
in_array($vbulletin->userinfo['userid'], $ignore_users)
); 
-edit fixed my typo
Reply With Quote
  #10  
Old 10-30-2006, 06:30 PM
bashy bashy is offline
 
Join Date: Nov 2005
Posts: 2,544
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thats the 1 m8, thank you very much for your help!!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:18 PM.


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.07065 seconds
  • Memory Usage 2,263KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (8)bbcode_code
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • 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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete