vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   VBOptions in array (https://vborg.vbsupport.ru/showthread.php?t=204104)

TheInsaneManiac 02-03-2009 07:07 PM

VBOptions in array
 
<if condition="in_array($bbuserinfo[userid], array($vbulletin->options['appsaccess']))">

When I go into my settings and type 498,3 then only user 498 will see the content, but user 3 won't. Why is this?

Lynne 02-03-2009 11:18 PM

I ran into the same thing on a mod I wrote a while ago. I had to do this (mine was for forumids, so change your condition appropriately).

In a plugin:
PHP Code:

$vfarray=$vbulletin->options[verify_forums];
$verifyforums explode(","$vfarray); 

In the template:
HTML Code:

<if condition=" in_array($threadinfo[forumid], $verifyforums)">

TheInsaneManiac 02-04-2009 01:21 AM

So I would have to make it a global plugin right?

Lynne 02-04-2009 03:00 AM

It depends on where you need whatever it is you are doing. If you only need it on one page, then I wouldn't use a plugin that is used on every page.

Dismounted 02-04-2009 04:54 AM

As you are already using a plugin, you may want move all your logic into your plugin as well (and just check if a variable is true or false inside the template).

TheInsaneManiac 02-04-2009 05:58 PM

Quote:

Originally Posted by Dismounted (Post 1733818)
As you are already using a plugin, you may want move all your logic into your plugin as well (and just check if a variable is true or false inside the template).

How can I go about that? Cause I don't want to add any extra queries, I just need this to run on my staff application area.

Lynne 02-04-2009 08:12 PM

Quote:

Originally Posted by TheInsaneManiac (Post 1734463)
How can I go about that? Cause I don't want to add any extra queries, I just need this to run on my staff application area.

You'd do something like this:

PHP Code:

$vfarray=$vbulletin->options[appsaccess];
$appsaccess explode(","$vfarray); 
if (
in_array($vbulletin->userinfo['userid'], $appsaccess)) $userinarray true

Then in your template:

HTML Code:

<if condition="$userarray == true">
do something
</if>

(not tested)


All times are GMT. The time now is 07:01 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.01640 seconds
  • Memory Usage 1,730KB
  • 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
  • (2)bbcode_html_printable
  • (2)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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