vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Need a conditional please? (https://vborg.vbsupport.ru/showthread.php?t=129568)

bashy 10-20-2006 08:31 PM

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

peterska2 10-20-2006 10:39 PM

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>

bashy 10-21-2006 02:59 PM

Thanks KA will try this :)

bashy 10-30-2006 05:25 PM

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?

Adrian Schneider 10-30-2006 05:32 PM

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.

bashy 10-30-2006 05:40 PM

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?

Adrian Schneider 10-30-2006 05:52 PM

Yeah it's a plugin. I'm not sure I understand your question though...

bashy 10-30-2006 05:59 PM

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?

Adrian Schneider 10-30-2006 06:24 PM

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

bashy 10-30-2006 06:30 PM

Thats the 1 m8, thank you very much for your help!! :)


All times are GMT. The time now is 06:42 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.01078 seconds
  • Memory Usage 1,743KB
  • 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
  • (8)bbcode_code_printable
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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