vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   correct syntax for this please (https://vborg.vbsupport.ru/showthread.php?t=168040)

lasto 01-17-2008 08:04 PM

correct syntax for this please
 
i have this code which is listed below.

Code:

if ($vbulletin->userinfo['userid'] != $info['userid'] AND $vbulletin->options['KarmaEditable'] && $vbulletin->userinfo['usergroupid'] != 5)
at moment its set for one usergroup how can i change the code to allow 2 usergroups as changing 5 at end to 5,6 simply wont work.

Opserty 01-17-2008 08:33 PM

PHP Code:

if (
    (
$vbulletin->userinfo['userid'] != $info['userid']) 
        && 
    (
$vbulletin->options['KarmaEditable']) 
        && 
    (!
is_member_of($vbulletin->userinfo56))
   ) 

(Just split it over 3 lines so its easier to read, you can condense it when you use it)

You can use in_array() to but the is_member_of function is better if your using vBulletin.

lasto 01-17-2008 08:45 PM

cheers m8 much appreciated

--------------- Added [DATE]1200610468[/DATE] at [TIME]1200610468[/TIME] ---------------

sorry m8 the code in the 1st post works fine but code in second does not.Can u make the syntax correct for the 1st post please as i noticed that is_member_of is different in 1st post to the code u actually printed

Lynne 01-17-2008 09:29 PM

Try this with array added in:

PHP Code:

if (
    (
$vbulletin->userinfo['userid'] != $info['userid']) 
        && 
    (
$vbulletin->options['KarmaEditable']) 
        && 
    (!
is_member_of($vbulletin->userinfo,array(5,6)))
   ) 


lasto 01-18-2008 03:16 PM

nope that never seemed to work.Im on vbull 3.5.7 and its calling the code from a php file so dont think can change the actual code in post 1 around.

Is there no way to add 2 usergoups into the same code which i have in post 1

Opserty 01-18-2008 03:24 PM

Hmm maybe is_member_of() has been added more recently then.

Use this is its place then:

PHP Code:

    (!in_array($vbulletin->userinfo['usergroupid'] , array(56))) 

P.S. Lynne, you can overload the is_member_of() function to check the userinfo against multiple usergroups.

Lynne 01-18-2008 03:24 PM

Quote:

Originally Posted by lasto (Post 1423818)
nope that never seemed to work.Im on vbull 3.5.7 and its calling the code from a php file so dont think can change the actual code in post 1 around.

Is there no way to add 2 usergoups into the same code which i have in post 1

Well, I suppose you could go:
PHP Code:

if ($vbulletin->userinfo['userid'] != $info['userid'] AND $vbulletin->options['KarmaEditable'] && ($vbulletin->userinfo['usergroupid'] != OR $vbulletin->userinfo['usergroupid'] != 6)) 


lasto 01-18-2008 08:22 PM

cheers lynne that worked fine.Appreciate your time and help on this.


All times are GMT. The time now is 06:37 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.01207 seconds
  • Memory Usage 1,738KB
  • 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
  • (1)bbcode_code_printable
  • (4)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)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