View Full Version : if in usergroup id
Dr.CustUmz
03-03-2015, 05:21 PM
i created a template where i have:
<if condition="is_member_of($post, $popbbgperm) AND $post[pbext] !== ''">
i created the variable inside of postbit_display_complete:
<hookname>postbit_display_complete</hookname>
<phpcode><![CDATA[
$popbbgperm = explode(',' , $vbulletin->options['drcpo_sup_pb_perm']);
eval('$popbbg = "' . fetch_template('pb_bg_img') . '";');
]]></phpcode>
and i have my options field able to use usergroup ids like 6,2, ect...
noting i do is working and its frustrating me like crazy, ive looked over some of BOPS scripts and the only difference i can rly see are i use is_member_of inside a template.
can anyone help me get it so if post user is member of usergroup show this.
You need to declare $vbulletin as global, or else use $this->registry instead, like $this->registry->options['drcpo_sup_pb_perm'].
Yeah, I know. That's one issue with the hook system. What you can do and what variables are there has to do with where they decided to put the hook. Eventually you get to what's goign on around the "popular" hooks, but I think the only way to really be able to write plugins its to set up the code so you can search all the files (I use notepad++ on my PC) and search for the hook name, and look at the code there.
Dr.CustUmz
03-03-2015, 05:42 PM
so declareing vbulletin global is that just using the requireonce global.php?
this is what its looking like
<template name="pb_bg_img" templatetype="template" date="0" username="DrCustUmz" version="1.0"><![CDATA[
<if condition="is_member_of($post,array($vboptions[drcpo_sup_pb_perm])) AND $post[pbext] !== ''">./$vboptions[drcpo_sup_pb_img_dir]/$post[userid].$post[pbext]<else />http://popoverdose.com/greig/upload/soft3.png</if>
]]></template>
</templates>
<plugins>
<plugin active="1" executionorder="5">
<title>cache supreme options template</title>
<hookname>cache_templates</hookname>
<phpcode><![CDATA[if (THIS_SCRIPT == 'profile'){
$globaltemplates = array_merge($globaltemplates, array('supreme'));
}
if (THIS_SCRIPT == 'showthread'){
$globaltemplates = array_merge($globaltemplates, array('pb_bg_img'));
}
]]></phpcode>
</plugin>
<plugin active="1" executionorder="5">
<title>varible for postbit</title>
<hookname>postbit_display_complete</hookname>
<phpcode><![CDATA[require_once('./global.php');
$popbbgperm = explode(',' , $vbulletin->options['drcpo_sup_pb_perm']);
eval('$popbbg = "' . fetch_template('pb_bg_img') . '";');
]]></phpcode>
</plugin>
Oh, sorry. I meant, put this line in your plugin code somewhere before you use $vbulletin:
global $vbulletin;
I'm not even sure "declaring it global" is the right php way to say it, it's just what I call it.
Dr.CustUmz
03-03-2015, 05:50 PM
scratch that we got it =)
$popbbgperm = explode(',' , $this->registry->options['drcpo_sup_pb_perm']);
fixed it ughh vbulletin sucks but theres always a way lol, thanks for coming through YET AGAIN you rock
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.