Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 03-03-2015, 05:21 PM
Dr.CustUmz's Avatar
Dr.CustUmz Dr.CustUmz is offline
 
Join Date: Aug 2013
Location: USA
Posts: 647
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default if in usergroup id

i created a template where i have:

Code:
<if condition="is_member_of($post, $popbbgperm) AND $post[pbext] !== ''">
i created the variable inside of postbit_display_complete:
Code:
<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.
Reply With Quote
  #2  
Old 03-03-2015, 05:34 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
Благодарность от:
Brandon Sheley
  #3  
Old 03-03-2015, 05:42 PM
Dr.CustUmz's Avatar
Dr.CustUmz Dr.CustUmz is offline
 
Join Date: Aug 2013
Location: USA
Posts: 647
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

so declareing vbulletin global is that just using the requireonce global.php?

this is what its looking like
Code:
<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>
Reply With Quote
  #4  
Old 03-03-2015, 05:44 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Oh, sorry. I meant, put this line in your plugin code somewhere before you use $vbulletin:
Code:
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.
Reply With Quote
  #5  
Old 03-03-2015, 05:50 PM
Dr.CustUmz's Avatar
Dr.CustUmz Dr.CustUmz is offline
 
Join Date: Aug 2013
Location: USA
Posts: 647
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

scratch that we got it =)
Code:
$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
Reply With Quote
Благодарность от:
Brandon Sheley
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:45 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03924 seconds
  • Memory Usage 2,203KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (5)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (2)post_thanks_box_bit
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete