vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   How to use "if" condition? (https://vborg.vbsupport.ru/showthread.php?t=320754)

Dragonsys 11-14-2015 03:04 AM

You might want to read the VB Manual or ask for someone to create the plugin for you at this point. We have basically written everything except the plugin(s) for auto template edits

Jennifer2010 11-19-2015 04:31 AM

Thanks for the response.

Just to make sure we're on the same page:

The original code I originally supplied is already an existing plugin that automatically inserts itself into every page/template on the site. So, is merely adding the usergroup restriction reversing the plugins existing ability of being inserted into every page?

Thank you!

MarkFL 11-19-2015 04:39 AM

Quote:

Originally Posted by Jennifer2010 (Post 2558974)
Thanks for the response.

Just to make sure we're on the same page:

The original code I originally supplied is already an existing plugin that automatically inserts itself into every page/template on the site. So, is merely adding the usergroup restriction reversing the plugins existing ability of being inserted into every page?

Thank you!

The plugin uses the hook location "global_start" so it will in fact be executed on every page. The usergroup restriction will determine whether the code within the conditional is executed or not, as determined by the the value returned by the is_member_of() function. If this function returns a true value, it will execute, but if it returns a false value it will not. :)

Jennifer2010 11-21-2015 04:37 AM

Quote:

Originally Posted by MarkFL (Post 2558975)
The plugin uses the hook location "global_start" so it will in fact be executed on every page. The usergroup restriction will determine whether the code within the conditional is executed or not, as determined by the the value returned by the is_member_of() function. If this function returns a true value, it will execute, but if it returns a false value it will not. :)

The hook is using init_startup (not global). Once I added the conditional, the code stopped executing.

This is the specific code with conditional included I'm talking about:

HTML Code:

<?xml version="1.0" encoding="ISO-8859-1"?>
<product productid="blockscript" active="1">
        <title>BlockScript vBulletin Integration</title>
        <description>BlockScript vBulletin Integration</description>
        <version>1.0</version>
        <url>http://www.blockscript.com/</url>
        <versioncheckurl />
        <dependencies />
        <codes />
        <templates />
        <plugins>
                <plugin active="1" executionorder="1">
                        <title>BlockScript vBulletin Integration</title>
                        <hookname>init_startup</hookname>
                        <phpcode><![CDATA[if (is_member_of($vbulletin->userinfo, array(1,2,3,4,8,17,19,20,26,15,22,16,14,18,21)))
{
        if (file_exists(CWD.'/blockscript/detector.php')) {
                include_once(CWD.'/blockscript/detector.php');
        } elseif (file_exists(CWD.'/../blockscript/detector.php')) {
                include_once(CWD.'/../blockscript/detector.php');
        } else {
                include_once(CWD.'/../../blockscript/detector.php');
        }
}]]></phpcode>
                </plugin>
        </plugins>
        <phrases />
        <options />
        <helptopics />
        <cronentries />
        <faqentries />
</product>


MarkFL 11-21-2015 11:33 AM

Change the hook location to global_start as suggested by Dragonsys because $vbulletin->userinfo is not defined at init_startup. :)

cellarius 11-21-2015 03:45 PM

But beware: global_start is not being executed in the CMS.

Jennifer2010 11-23-2015 04:18 PM

Quote:

Originally Posted by MarkFL (Post 2559065)
Change the hook location to global_start as suggested by Dragonsys because $vbulletin->userinfo is not defined at init_startup. :)

Ah, that worked! When I had did that the first time we were talking about template edits so I didn't realize that was going to work. Thanks again guys!


All times are GMT. The time now is 07:37 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.00995 seconds
  • Memory Usage 1,738KB
  • 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
  • (1)bbcode_html_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete