vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Usergroup check in plugin (https://vborg.vbsupport.ru/showthread.php?t=281137)

Davey-UK 04-05-2012 06:48 AM

Usergroup check in plugin
 
Hopefully you will be able to understand my needs here. I will try to explain the best i can.

I have the following piece of code in a plugin i am trying to work with:
Code:

$schbot = ($vbulletin->superglobal_size['_COOKIE'] == 0 AND preg_match("#(google|msnbot)#si", $_SERVER['HTTP_USER_AGENT']));
               
                        // check if user is in a certain usergroup and if system is enabled                               
                        if ($show['guest'] AND !$schbot AND $vbulletin->options['schison'])

The part highlighted in red is the bit i need to modify. I want it to check if the user is in a certain usergroup (2).

I have read about the conditionals, and got the following:
Code:

is_member_of($bbuserinfo, 2)
But if i simply exchange one for the other, as below, it doesnt work.
Code:

$schbot = ($vbulletin->superglobal_size['_COOKIE'] == 0 AND preg_match("#(google|msnbot)#si", $_SERVER['HTTP_USER_AGENT']));
               
                        // check if user is in a certain usergroup and if system is enabled                               
                        if (is_member_of($bbuserinfo, 2) AND !$schbot AND $vbulletin->options['schison'])

Can someone point me in the right direction, before i pull my hair out! Please. :)

Basically the code is making sure i am not from google or msn, and if i am in usergroup 2 it will fire a message.

kh99 04-05-2012 07:37 AM

You didn't say which hook you're using so I'm not sure, but try:

Code:

is_member_of($vbulletin->userinfo, 2)

Davey-UK 04-05-2012 07:57 AM

You've only gone and done it first shot!
Thankyou so much. I'm sure i will be back for more info. :)
Thanks again:up:


All times are GMT. The time now is 08:38 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.00950 seconds
  • Memory Usage 1,715KB
  • 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
  • (4)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)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