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($vbulletin->userinfo, $vbulletin->options[gcm_ug]) (https://vborg.vbsupport.ru/showthread.php?t=223309)

Giangy94 09-16-2009 06:12 AM

is_member_of($vbulletin->userinfo, $vbulletin->options[gcm_ug])
 
HI to all,
I'm creating a mod for a marquee system and I have a problem with the groups who should see the phrase :)

Hi created an option:
PHP Code:

  <setting varname="gcm_ug" displayorder="5">
  <
datatype>free</datatype
  <
defaultvalue>2,5,6,7</defaultvalue
  </
setting

and in the templates I put this:
PHP Code:

<if condition="$vbulletin->options[gcm_it] == itm AND is_member_of($vbulletin->userinfo$vbulletin->options[gcm_ug]) 

Now if I, in the field, enter only one id it works...but if I enter more ids it doesn't work....

Example: I enter 6(id for administrators) and I see the phrase; I enter 2, 6 or 2,6 and don't see the phrase :(



I don't understand why :eek:

ragtek 09-16-2009 09:55 AM

I would use the permissionsystem istead of something like this.
I have nothing more, than add-ons where i have to set the permissions in the script or the settings

https://vborg.vbsupport.ru/showthrea...ht=permissions

Lynne 09-16-2009 01:37 PM

First, you don't use $vbulletin->userinfo or $vbulletin->options[gcm_ug] in templates. It would be $bbuserinfo and $vboptions[gcm_ug]. But, besides that $vboptions[gcm_ug] is an array and I don't think you can treat it the way you did. You may need to explode it in a plugin and then use it.

Giangy94 09-17-2009 04:09 PM

Quote:

I would use the permissionsystem istead of something like this.
I have nothing more, than add-ons where i have to set the permissions in the script or the settings
https://vborg.vbsupport.ru/showt...ht=permissions
I created a file named "bitfield_marqueesystem.xml" and i put this code:
PHP Code:

<?xml version="1.0" encoding="ISO-8859-1"?>
<bitfields product="marqueesystem">
    <bitfielddefs>
        <group name="ugp">
            <group name="marqueepermissions">
                <bitfield name="canviewmarquee" group="marquee_permission" phrase="can_view_marquee" install="2,3,4,5,6,7">1></bitfield>
            </group>
        </group>
    </bitfielddefs>
</bitfields>


Then I put this in my mod file:
PHP Code:

<code version="1.0">
 <
installcode>
 <![
CDATA$vbulletin->db->hide_errors();
 
$vbulletin->db->query_write("ALTER TABLE usergroup ADD marqueepermissions INT UNSIGNED NOT NULL DEFAULT 0;");
                 
$vbulletin->db->show_errors();
]]> 
  </
installcode
 <
uninstallcode>
 <![
CDATA[                 $vbulletin->db->hide_errors();
                
$vbulletin->db->query_write("ALTER TABLE " TABLE_PREFIX "usergroup DROP marqueepermissions");
                
$vbulletin->db->show_errors();
  ]]> 
  </
uninstallcode>
</
code
    </
codes

PHP Code:

<plugin active="1" executionorder="5">
  <
title>Usergroup Permission</title
  <
hookname>global_start</hookname
<
phpcode>
<![
CDATA[ if ($vbulletin->bf_ugp_marqueepermissions['canviewmarquee'] == 'yes')
{

eval(
'print_output("' fetch_template('marquee_text) . '");');

}  
  ]]> 
  </phpcode>
  </plugin> 


Are they correct? :)



Quote:

you don't use $vbulletin->userinfo or $vbulletin->options[gcm_ug] in templates. It would be $bbuserinfo and $vboptions[gcm_ug]
Thanks, I changed all "$vbulletin->options" to "$vboptions" :)


All times are GMT. The time now is 11:30 AM.

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.01599 seconds
  • Memory Usage 1,739KB
  • 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
  • (5)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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