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

Reply
 
Thread Tools Display Modes
  #1  
Old 07-26-2014, 04:14 PM
donkspurs donkspurs is offline
 
Join Date: Aug 2012
Posts: 23
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Default text to display in every first post

I'm trying to display some text which will show in every first post in every thread, but I also only want it to display in a specific forum section. The id of the forum is definitely 22 and I've already found some code which apparently should work.

Here is the code I am currently using in the template "ad_showthread_firstpost_start".

Code:
<vb:if condition="$forum[forumid] == 22">

This is the custom text.

</vb:if>
However for some reason this text doesn't display at all in the threads in the specified forum.

If I remove the if condition then the text displays fine, but it obviously then displays in every single thread on the site.

I am testing this on a dev forum so the forums are turned off. I can't see that being an issue but thought worth mentioning in case.

Any help would be much appreciated! Thanks.
Reply With Quote
  #2  
Old 07-26-2014, 05:18 PM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Have you tried using $thread rather than $forum ?
Reply With Quote
Благодарность от:
donkspurs
  #3  
Old 07-26-2014, 05:23 PM
donkspurs donkspurs is offline
 
Join Date: Aug 2012
Posts: 23
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Paul M View Post
Have you tried using $thread rather than $forum ?
Thanks for the help.

I hadn't tried that until you just suggested it but sadly it didn't make any difference.
Reply With Quote
  #4  
Old 07-27-2014, 05:31 PM
donkspurs donkspurs is offline
 
Join Date: Aug 2012
Posts: 23
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Has anyone on here ever tried to get default text into the first post of every threads in a specific forum?

Must be someone on here! Any help on how to do it would be greatly appreciated, thanks!
Reply With Quote
  #5  
Old 07-28-2014, 11:12 AM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Looking at the code, you cannot do this without a using a hook.

No variables other than the adsense details are registered for that template when its created, so you need to pre-register either $forum or $thread.

PHP Code:
vB_Template::preRegister('ad_showthread_firstpost_start',array('thread' => $thread)); 

The 'postbit_display_complete' hook should be ok to use.
Reply With Quote
  #6  
Old 07-28-2014, 04:43 PM
donkspurs donkspurs is offline
 
Join Date: Aug 2012
Posts: 23
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Paul M View Post
Looking at the code, you cannot do this without a using a hook.

No variables other than the adsense details are registered for that template when its created, so you need to pre-register either $forum or $thread.

PHP Code:
vB_Template::preRegister('ad_showthread_firstpost_start',array('thread' => $thread)); 

The 'postbit_display_complete' hook should be ok to use.
Thanks once more for the help!

Unfortunately I haven't done any work with hooks before so not sure where to start!

Where would I find the 'postbit_display_complete' hook? Thanks again.
Reply With Quote
  #7  
Old 07-28-2014, 05:00 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Go to admincp > Plugins and Products > Add New Plugin and the hooks location is a dropdown and you will find it there.
Reply With Quote
Благодарность от:
donkspurs
  #8  
Old 07-29-2014, 12:07 AM
donkspurs donkspurs is offline
 
Join Date: Aug 2012
Posts: 23
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you guys! That worked brilliantly.

Excellent help. Really appreciate it!
Reply With Quote
  #9  
Old 08-26-2014, 03:54 PM
DannyITR DannyITR is offline
 
Join Date: Jan 2002
Posts: 325
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is there any way to adapt this so that the text is entered into the post box while the user is typing the post?

I want to have default text in my for sale sections so users will know what is expected in terms of info.
Reply With Quote
  #10  
Old 08-26-2014, 08:01 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Go search for the Stencil Mod. That should do what you want.
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 11:09 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.04492 seconds
  • Memory Usage 2,269KB
  • 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
  • (1)bbcode_code
  • (2)bbcode_php
  • (2)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