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

Reply
 
Thread Tools Display Modes
  #1  
Old 07-07-2009, 10:52 AM
markuswarren markuswarren is offline
 
Join Date: May 2009
Posts: 26
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Use custom template within postbit_legacy

Hello all,
I've followed the advice in this thread on how to add a custom template using plugins and it's working perfectly for a custom template I've setup to be displayed in the header template.

I wanted to do something similar for the postbit_legacy template. I have badges that appear in the user's postbit depending on certain criteria, be they picked up from a custom profile field or via membership of a usergroup.

At present my code for this is within the postbit_legacy template and thus when I need to edit the badge code I need to edit postbit_legacy. I thought it would be somewhat cleaner, and prevent me from accidentally deleting something, if I used a custom template for my badge code, and then called that template from within postbit_legacy.

I create two new plugins for the new template, change the values to match my new template name, then put the variable in postbit_legacy but it does not seem to be loading the new template.

Is there something special I need to do to get this to work for postbit_legacy, or is it something that cannot be done?
Reply With Quote
  #2  
Old 07-07-2009, 02:25 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It should work since I do that on my site. You didn't post your plugin code or tell us which hook locations you are using, so it's hard to tell where you may have made your error.
Reply With Quote
  #3  
Old 07-08-2009, 12:51 PM
markuswarren markuswarren is offline
 
Join Date: May 2009
Posts: 26
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hello Lynne,
Well it would be *far* too helpful if I actually posted the code wouldn't it?

Here are the screenshots of the two plugins I've setup:






I've created a new template in my style and named it "custom_badges" (without the quotes of course). All it currently contains is the following text: "TEXT FOR CUSTOM BADGES"

I've then edited the postbit_legacy template and entered "$custom_badges" (again without the quotes) in the position where I want the custom template code to appear. I've cleared history and cache in my browser and quit and relaunched but the custom text isn't displayed.

I'm thinking perhaps it might be the hook location for "parse template custom_badges" which is set to "parse_templates", and that it should be changed to something else; postbit_display_complete?
Reply With Quote
  #4  
Old 07-08-2009, 02:06 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Images are not my friend right now (I'm on vacation and stuck on dial-up). But, I think you are correct in that your hook location is incorrect. I use the postbit_display_start to eval my template (although mine is also using a template_hook, but that shouldn't matter). Just try changing the hook location and see if it works then.
Reply With Quote
  #5  
Old 07-08-2009, 02:15 PM
markuswarren markuswarren is offline
 
Join Date: May 2009
Posts: 26
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Apologies for the images, I'm lazy!

I'll try changing the hook location and will report back

--------------- Added [DATE]1247067674[/DATE] at [TIME]1247067674[/TIME] ---------------

I've just tried changing the hook to "postbit_display_complete" and it is now working! Thank you for you help, it is much appreciated.
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 02:44 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.03765 seconds
  • Memory Usage 2,196KB
  • Queries Executed 11 (?)
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
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (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_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
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete