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 01-17-2008, 08:04 PM
lasto lasto is offline
 
Join Date: Jan 2002
Posts: 1,514
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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.
Reply With Quote
  #2  
Old 01-17-2008, 08:33 PM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #3  
Old 01-17-2008, 08:45 PM
lasto lasto is offline
 
Join Date: Jan 2002
Posts: 1,514
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #4  
Old 01-17-2008, 09:29 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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)))
   ) 
Reply With Quote
  #5  
Old 01-18-2008, 03:16 PM
lasto lasto is offline
 
Join Date: Jan 2002
Posts: 1,514
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #6  
Old 01-18-2008, 03:24 PM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #7  
Old 01-18-2008, 03:24 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by lasto View Post
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)) 
Reply With Quote
  #8  
Old 01-18-2008, 08:22 PM
lasto lasto is offline
 
Join Date: Jan 2002
Posts: 1,514
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

cheers lynne that worked fine.Appreciate your time and help on this.
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 12:38 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03854 seconds
  • Memory Usage 2,241KB
  • Queries Executed 11 (?)
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
  • (1)bbcode_code
  • (4)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)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