Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 01 Aug 2011, 16:16
gothicuser's Avatar
gothicuser gothicuser is offline
 
Join Date: Apr 2004
Real name: Tony
Plugin for specific styleid

Been trying to write a plugin that will have effect on only one (or only) style installed.
I have tried

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

No good
I also tried

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View 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

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

and yes, I am rendering and caching the template first.
__________________
Grumpy and bad tempered. I'm a pensioner, so don't care any more
Reply With Quote
  #2  
Old 01 Aug 2011, 16:37
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
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 01 Aug 2011, 16:53
gothicuser's Avatar
gothicuser gothicuser is offline
 
Join Date: Apr 2004
Real name: Tony
Many thanks for the really fast reply, I will play.

Please excuse my ignorance, what do you mean by:
Originally Posted by kh99 View Post
put in a "global $styleid;" line first.
__________________
Grumpy and bad tempered. I'm a pensioner, so don't care any more
Reply With Quote
  #4  
Old 01 Aug 2011, 16:57
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
Originally Posted by gothicuser View Post
Please excuse my ignorance, what do you mean by:
I mean something like this:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


But like I mentioned above, I don't see why $vbulletin->userinfo[styleid] shouldn't work.
Reply With Quote
  #5  
Old 01 Aug 2011, 17:01
gothicuser's Avatar
gothicuser gothicuser is offline
 
Join Date: Apr 2004
Real name: Tony
Thats great. I will try this now.
Originally Posted by kh99 View Post
I mean something like this:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

But like I mentioned above, I don't see why $vbulletin->userinfo[styleid] shouldn't work.
--------------- Added 01 Aug 2011 at 17:10 ---------------

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.
__________________
Grumpy and bad tempered. I'm a pensioner, so don't care any more
Reply With Quote
  #6  
Old 01 Aug 2011, 18:50
ry215's Avatar
ry215 ry215 is offline
 
Join Date: May 2006
Real name: Nelson

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

You can change


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

to


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

to use one more style.
__________________
My Mods & Styles

Contace me now for more details!
Reply With Quote
  #7  
Old 01 Aug 2011, 18:52
Adrian Schneider's Avatar
Adrian Schneider Adrian Schneider is offline
 
Join Date: Jul 2004
I usually use the STYLEID constant.
Reply With Quote
  #8  
Old 01 Aug 2011, 19:02
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
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 01 Aug 2011, 20:55
TheLastSuperman's Avatar
TheLastSuperman TheLastSuperman is offline
 
Join Date: Sep 2008
Real name: Michael Miller Jr
Some more examples


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Or


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

X being the styleid #
__________________
Daddy Does Dios and Figs!
https://www.linkedin.com/in/thelastsuperman

Search - Use the search feature to find similar issues/answers.
Information - Include screenshots, copy/pasted error codes, url etc.
Fixed - Please return to your thread/post and let us know how it was fixed!
Thanks - For participating! Click the "Like" on a post if someone helped you!
Reply With Quote
  #10  
Old 01 Aug 2011, 20:59
gothicuser's Avatar
gothicuser gothicuser is offline
 
Join Date: Apr 2004
Real name: Tony
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.
__________________
Grumpy and bad tempered. I'm a pensioner, so don't care any more
Reply With Quote
  #11  
Old 01 Aug 2011, 21:27
Adrian Schneider's Avatar
Adrian Schneider Adrian Schneider is offline
 
Join Date: Jul 2004
I could be mistaken, but I wouldn't trust $vbulletin->session->vars['styleid'] or $vbulletin->userinfo['styleid']. $styleid and STYLEID are the only one two options which represent what was actually used.
Reply With Quote
  #12  
Old 01 Aug 2011, 22:24
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
Originally Posted by Adrian Schneider View Post
I could be mistaken, but I wouldn't trust $vbulletin->session->vars['styleid'] or $vbulletin->userinfo['styleid']. $styleid and STYLEID are the only one two options which represent what was actually used.
Yes, you're right as usual. I had looked at fetch_style_record() and it looked like $styleid was set to the same as $vbulletin->userinfo['styleid'], but I missed the fact that a plugin on hook style_fetch could change it, or it could use $vbulletin->options['styleid'] if $styleid ends up being invalid.


So just to clarify, gothicuser, Adrian's


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


is the way to go (no "global needed").

Last edited by kh99; 01 Aug 2011 at 22:29.
Reply With Quote
  #13  
Old 02 Aug 2011, 06:42
gothicuser's Avatar
gothicuser gothicuser is offline
 
Join Date: Apr 2004
Real name: Tony
Thankyou.
I have used

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Which is working fine.
__________________
Grumpy and bad tempered. I'm a pensioner, so don't care any more
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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


New To Site? Need Help?

All times are GMT. The time now is 17:01.

Layout Options | Width: Wide Color: