vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   if in usergroup id (https://vborg.vbsupport.ru/showthread.php?t=317619)

Dr.CustUmz 03-03-2015 05:21 PM

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.

kh99 03-03-2015 05:34 PM

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
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>


kh99 03-03-2015 05:44 PM

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.

Dr.CustUmz 03-03-2015 05:50 PM

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


All times are GMT. The time now is 06:15 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.02478 seconds
  • Memory Usage 1,719KB
  • 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_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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