vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   is_member_of problem (https://vborg.vbsupport.ru/showthread.php?t=168304)

ragtek 01-20-2008 03:54 PM

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?

Opserty 01-20-2008 04:06 PM

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

(You'll need to explode() it if it is a character delimited list of group Ids.)

ragtek 01-20-2008 04:12 PM

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

nexialys 01-20-2008 04:20 PM

have to be
PHP Code:

if(is_member_of($vbulletin->userinfoexplode(','$vbulletin->options['login_groups']))) { 


ragtek 01-20-2008 04:25 PM

ok thx

Opserty 01-20-2008 04:26 PM

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. ;)

ragtek 01-20-2008 04:32 PM

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

nexialys 01-20-2008 05:12 PM

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... ;)

ragtek 01-20-2008 05:27 PM

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...)

nexialys 01-20-2008 06:06 PM

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...


All times are GMT. The time now is 09:58 PM.

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.00977 seconds
  • Memory Usage 1,737KB
  • 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)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete