Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 08-01-2011, 02:16 PM
gothicuser's Avatar
gothicuser gothicuser is offline
 
Join Date: Apr 2004
Location: Kernow, Nr. UK
Posts: 468
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Plugin for specific styleid

Been trying to write a plugin that will have effect on only one (or only) style installed.
I have tried
PHP Code:
if ($styleid == 1){
Code

No good
I also tried
PHP Code:
if ($vbulletin->userinfo[styleid]==1)
{
code
No good
I am missing something, anybody have suggestions pretty please.

p.s. another thing, should the plugin run at 'parse_templates' or 'style_fetch'. The code is
PHP Code:
$vbulletin->templatecache['footer'] = $vbulletin->templatecache['jqt_suite_footer']; 
and yes, I am rendering and caching the template first.
Reply With Quote
  #2  
Old 08-01-2011, 02:37 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think parse_templates is good, and at that hook it looks like $vbulletin->userinfo[styleid] should have worked. You could also try $styleid but put in a "global $styleid;" line first.
Reply With Quote
  #3  
Old 08-01-2011, 02:53 PM
gothicuser's Avatar
gothicuser gothicuser is offline
 
Join Date: Apr 2004
Location: Kernow, Nr. UK
Posts: 468
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Many thanks for the really fast reply, I will play.

Please excuse my ignorance, what do you mean by:
Quote:
Originally Posted by kh99 View Post
put in a "global $styleid;" line first.
Reply With Quote
  #4  
Old 08-01-2011, 02:57 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by gothicuser View Post
Please excuse my ignorance, what do you mean by:
I mean something like this:

Code:
global $styleid;

if ($styleid == 1){
Code
}

But like I mentioned above, I don't see why $vbulletin->userinfo[styleid] shouldn't work.
Reply With Quote
  #5  
Old 08-01-2011, 03:01 PM
gothicuser's Avatar
gothicuser gothicuser is offline
 
Join Date: Apr 2004
Location: Kernow, Nr. UK
Posts: 468
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thats great. I will try this now.
Quote:
Originally Posted by kh99 View Post
I mean something like this:

Code:
global $styleid;

if ($styleid == 1){
Code
}
But like I mentioned above, I don't see why $vbulletin->userinfo[styleid] shouldn't work.
--------------- Added [DATE]1312215039[/DATE] at [TIME]1312215039[/TIME] ---------------

Using the 'global $styleid;' first certainly triggers the template replacement, but what happens now is that both the original and replacement templates are trying to display...
Ahh! just had a thought.
Think I know whats happening, I'll let you know later.
Reply With Quote
  #6  
Old 08-01-2011, 04:50 PM
ry215 ry215 is offline
 
Join Date: Apr 2006
Location: Paraguay
Posts: 508
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
$xstyleid '1';
$nstyleid preg_split('#\s+#s'$xstyleid, -1PREG_SPLIT_NO_EMPTY);
    if (
in_array($style['styleid'],$nstyleid))
    {
        
CODE HERE;
    } 
You can change

PHP Code:
$xstyleid '1'
to

PHP Code:
$xstyleid '1 3 5 12 54'
to use one more style.
Reply With Quote
Благодарность от:
gothicuser
  #7  
Old 08-01-2011, 04:52 PM
Adrian Schneider's Avatar
Adrian Schneider Adrian Schneider is offline
 
Join Date: Jul 2004
Posts: 2,528
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I usually use the STYLEID constant.
Reply With Quote
Благодарность от:
kh99
  #8  
Old 08-01-2011, 05:02 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Adrian Schneider View Post
I usually use the STYLEID constant.
Ah...good call, that certainly solves that issue.
Reply With Quote
  #9  
Old 08-01-2011, 06:55 PM
TheLastSuperman's Avatar
TheLastSuperman TheLastSuperman is offline
Senior Member
 
Join Date: Sep 2008
Location: North Carolina
Posts: 5,844
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Some more examples

Code:
if ($vbulletin->session->vars['styleid'] == X)
{
Plugin Code
}
Or

Code:
if ($vbulletin->session->vars['styleid'] != X)
{
Plugin Code
}
X being the styleid #
Reply With Quote
  #10  
Old 08-01-2011, 06:59 PM
gothicuser's Avatar
gothicuser gothicuser is offline
 
Join Date: Apr 2004
Location: Kernow, Nr. UK
Posts: 468
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hey guys, such a response. Thankyou all.
Too late in the evening to play right now, mrs will torture me!! will let you know how it went in the morning (the coding I mean).
Thanks again.
Reply With Quote
Reply


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 01:16 AM.


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.04348 seconds
  • Memory Usage 2,275KB
  • 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
  • (4)bbcode_code
  • (6)bbcode_php
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (2)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete