PDA

View Full Version : is_member_of($vbulletin->userinfo, $vbulletin->options[gcm_ug])


Giangy94
09-16-2009, 07:12 AM
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:
<setting varname="gcm_ug" displayorder="5">
<datatype>free</datatype>
<defaultvalue>2,5,6,7</defaultvalue>
</setting>

and in the templates I put this:
<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, 10: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/showthread.php?t=82844&highlight=permissions

Lynne
09-16-2009, 02: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, 05:09 PM
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:
<?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:
<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>

<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? :)



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" :)