Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 01-20-2008, 03:54 PM
ragtek ragtek is offline
 
Join Date: Mar 2006
Location: austria, croatia
Posts: 1,630
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default is_member_of problem

hi
i don't understand why this https://vborg.vbsupport.ru/showthrea...17#post1425217 is a problem
the function is built this way:
PHP Code:
// #############################################################################
/**
* Works out if a user is a member of the specified usergroup(s)
*
* This function can be overloaded to test multiple usergroups: is_member_of($user, 1, 3, 4, 6...)
*
* @param    array        User info array - must contain userid, usergroupid and membergroupids fields
* @param    integer    Usergroup ID to test
* @param boolean    Pull result from cache
*
* @return    boolean
*/
function is_member_of(&$userinfo$usergroupid$cache true
so when i'm having:
PHP Code:
    if (is_member_of($vbulletin->userinfo$vbulletin->options['login_groups']))
    { 
and in login_groups stands: 3,4 then it should be
PHP Code:
    if (is_member_of($vbulletin->userinfo3,4))
    { 
but it seems at it isn't

does somebody know what i'm making false?
Reply With Quote
  #2  
Old 01-20-2008, 04:06 PM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Whats the value of $vbulletin->options['login_groups']?

(You'll need to explode() it if it is a character delimited list of group Ids.)
Reply With Quote
  #3  
Old 01-20-2008, 04:12 PM
ragtek ragtek is offline
 
Join Date: Mar 2006
Location: austria, croatia
Posts: 1,630
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The value is 2,3,4

It is a default fielt(textfield).
So i thouth it is saved as 2,3 into the db and then i can just insert the value into the function
Reply With Quote
  #4  
Old 01-20-2008, 04:20 PM
nexialys
Guest
 
Posts: n/a
Default

have to be
PHP Code:
if(is_member_of($vbulletin->userinfoexplode(','$vbulletin->options['login_groups']))) { 
Reply With Quote
  #5  
Old 01-20-2008, 04:25 PM
ragtek ragtek is offline
 
Join Date: Mar 2006
Location: austria, croatia
Posts: 1,630
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ok thx
Reply With Quote
  #6  
Old 01-20-2008, 04:26 PM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

As nexialys has shown you need to explode it as 2,3,4 appears to PHP as string, like "2,3,4," so when you insert it into your function it would look like this: is_member_of($vbulletin->userinfo, "2,3,4") which as you have found won't work.
Reply With Quote
  #7  
Old 01-20-2008, 04:32 PM
ragtek ragtek is offline
 
Join Date: Mar 2006
Location: austria, croatia
Posts: 1,630
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

but then it returns an array.
and in the functioninformation there is no array required, so i thought it must be a list of numbers..

thx
Reply With Quote
  #8  
Old 01-20-2008, 05:12 PM
nexialys
Guest
 
Posts: n/a
Default

having read the next lines after the function is_member_of() { would have give you a hint, it verify if the $usergroupid is an array or not...
Reply With Quote
  #9  
Old 01-20-2008, 05:27 PM
ragtek ragtek is offline
 
Join Date: Mar 2006
Location: austria, croatia
Posts: 1,630
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

have you nothing to do with your baby, instead of saying/writing that i'm not reading the whole function?:P
*joke*

but yes, thats right
i thought the whole time that this is also so a function which accepts a string like the documentation sais:
Code:
* This function can be overloaded to test multiple usergroups: is_member_of($user, 1, 3, 4, 6...)
Reply With Quote
  #10  
Old 01-20-2008, 06:06 PM
nexialys
Guest
 
Posts: n/a
Default

hum the function documentation have a typo then... you can report it to the official site

and yeah, i have a newborn, but i also have a wife and 3 other kids to take care of a 7 pounds baby.. lol... i take care of her when everybody is exhausted...
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 04:26 AM.


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.10635 seconds
  • Memory Usage 2,256KB
  • 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
  • (4)bbcode_php
  • (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
  • (7)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