Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 08-07-2006, 11:55 PM
VodkaFish VodkaFish is offline
 
Join Date: Oct 2003
Posts: 125
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default in_array problems

I was using this to set permissions on a php page:

PHP Code:
if (in_array($vbulletin->userinfo['usergroupid'], array(1348))) { 
    
print_no_permission(); 

However, now that I've upgraded to php 5 (and vb 3.6), it's simply blocking everyone, not just those usergroups. I don't really see any difference for in_array between php 4 and 5, did something change in vb?
Reply With Quote
  #2  
Old 08-08-2006, 06:02 AM
Freesteyelz's Avatar
Freesteyelz Freesteyelz is offline
 
Join Date: Jan 2006
Posts: 1,552
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think it should be:

Code:
if (is_member_of($vbulletin->userinfo, 1, 3, 4, 8))
Reply With Quote
  #3  
Old 08-08-2006, 06:19 AM
VodkaFish VodkaFish is offline
 
Join Date: Oct 2003
Posts: 125
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for the response. I gave that a shot earlier and it's weird, everyone is still being blocked.

If I do:
PHP Code:
echo is_member_of($vbulletin->userinfo['usergroupid'], array(1348)); 
I get nothing.
PHP Code:
echo $vbulletin->userinfo['usergroupid']; 
I get my correct usergroupid.
PHP Code:
echo is_member_of($vbulletin->userinfo1348); 
I get nothing again.
Reply With Quote
  #4  
Old 08-08-2006, 06:29 AM
Dilmah Dilmah is offline
 
Join Date: May 2005
Posts: 58
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

is_member_of($vbulletin->userinfo, 1,3,4,8);
Reply With Quote
  #5  
Old 08-08-2006, 06:43 AM
VodkaFish VodkaFish is offline
 
Join Date: Oct 2003
Posts: 125
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Unfortunately that produces the same result.
Reply With Quote
  #6  
Old 08-08-2006, 06:52 AM
Dilmah Dilmah is offline
 
Join Date: May 2005
Posts: 58
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What's code did you use?
Reply With Quote
  #7  
Old 08-10-2006, 03:02 PM
VodkaFish VodkaFish is offline
 
Join Date: Oct 2003
Posts: 125
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dilmah
What's code did you use?
I tried both:
PHP Code:
if (in_array($vbulletin->userinfo['usergroupid'], array(1348))) { 
    
print_no_permission(); 

and
PHP Code:
if (is_member_of($vbulletin->userinfo1,3,4,8)) { 
    
print_no_permission(); 

Reply With Quote
  #8  
Old 08-10-2006, 05:36 PM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Use this and post the full results back here;

PHP Code:
print_r($vbulletin->userinfo);
if (
is_member_of($vbulletin->userinfo1,3,4,8)) 
{  
    echo 
"No Permission <br />";  
}
exit; 
Reply With Quote
  #9  
Old 08-10-2006, 05:47 PM
VodkaFish VodkaFish is offline
 
Join Date: Oct 2003
Posts: 125
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Array ( [userid] => 2105 [usertitle] => Owner [customtitle] => 1 [joindate] => 949813200 [daysprune] => 0 [lastvisit] => 1155232031 [lastactivity] => 1155232031 [lastpost] => 1155229271 [posts] => 12168 [timezoneoffset] => -5 [membergroupids] => [displaygroupid] => 6 [reputation] => 350
Reply With Quote
  #10  
Old 08-10-2006, 06:09 PM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've removed alot of the unnecessary stuff from your post

You are a member of usergroup 6 and didn't get "No Permission" echoed out, so it seems to be working to me.
Reply With Quote
Reply

Thread Tools
Display Modes

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 03:00 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.04917 seconds
  • Memory Usage 2,260KB
  • 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
  • (1)bbcode_code
  • (7)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (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_postinfo_query
  • fetch_postinfo
  • 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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete