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 05-13-2012, 07:01 AM
charlesr charlesr is offline
 
Join Date: Aug 2009
Posts: 177
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Add a word to the title of every new topic in a certain forum folder?

I have a folder in which people post their first impressions / reviews of videogames.
Is there a simple template mod I could do to add a phrase to the end of each topic title (and associated url) in that folder at creation time?

Phrase would be "review", so it would change a topic title of "sniper elite" to "sniper elite review".
Forum number is 24.
Reply With Quote
  #2  
Old 05-13-2012, 08:09 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Why not just use thread prefixes? [Review] Sniper Elite
Reply With Quote
  #3  
Old 05-13-2012, 08:25 AM
Badshah93 Badshah93 is offline
 
Join Date: Jun 2010
Location: India
Posts: 505
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

you can use prefix or create plugin

Plugin Hook: newpost_process
Title: anything
Code:
PHP Code:
if ($foruminfo['forumid'] == 24 and $type == 'thread')
{
$post['title'] = $post['title'] . ' review';

this will save all threads with word 'review' at last.
Reply With Quote
Благодарность от:
charlesr
  #4  
Old 05-13-2012, 06:24 PM
charlesr charlesr is offline
 
Join Date: Aug 2009
Posts: 177
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for both of your suggestions.

Boofo: is there a way of defaulting the prefix to a particular prefix in the new thread dropdown? I could only get it to display "no prefix" as the default, so a user would have to change to the "review" prefix manually. I don't really want them to have to DO anything. I set "require prefix" in the forum options, but it doesn't warn them they forgot until after they press submit.

Badshah 93: That worked a treat thanks.
Reply With Quote
  #5  
Old 05-13-2012, 06:34 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Check out the "Edit Selected Prefix Permissions" in the Thread Prefix Manager.
Reply With Quote
  #6  
Old 05-15-2012, 02:50 PM
charlesr charlesr is offline
 
Join Date: Aug 2009
Posts: 177
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can something be done to the meta description at the same time? I couldn't figure out if the description is generated from a field in the database (couldn't find one) or on the fly from the contents of the first post. How would I figure that out?

Ideally in my simple world it would be as easy as:
Code:
if ($foruminfo['forumid'] == 24 and $type == 'thread')
{
$post['title'] = $post['title'] . ' review';
$thread['description'] = 'A review of ' . $post['title'] . ' - ' . $thread['description'];
}
But obviously not that because there's no description field in thread or post that I can see.
Reply With Quote
  #7  
Old 05-15-2012, 02:59 PM
Badshah93 Badshah93 is offline
 
Join Date: Jun 2010
Location: India
Posts: 505
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by charlesr View Post
Can something be done to the meta description at the same time? I couldn't figure out if the description is generated from a field in the database (couldn't find one) or on the fly from the contents of the first post. How would I figure that out?

Ideally in my simple world it would be as easy as:
Code:
if ($foruminfo['forumid'] == 24 and $type == 'thread')
{
$post['title'] = $post['title'] . ' review';
$thread['description'] = 'A review of ' . $post['title'] . ' - ' . $thread['description'];
}
But obviously not that because there's no description field in thread or post that I can see.

Create new plugin

Hook: showthread_complete
Title: ur wish
Php Code:

PHP Code:
if ($foruminfo['forumid'] == 24)
{
$thread['meta_description'] = 'A review of ' $thread['title'] . ' - ' $thread['meta_description'];

Reply With Quote
Благодарность от:
kh99
  #8  
Old 05-15-2012, 03:06 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The description is the text of the first post, and the value for the description tag is that text with quotes and bbcode removed, censored, then cut down to 500 chars max. That's all done at the time the thread is displayed so if you want to modify the description meta tag on the showthread page then you'd need a plugin using a hook like showthread_complete, and you can modify the string in $thread['meta_description'].

Edit: Oops. Badshah beat me to it.
Reply With Quote
Благодарность от:
charlesr
  #9  
Old 05-16-2012, 05:43 AM
charlesr charlesr is offline
 
Join Date: Aug 2009
Posts: 177
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Wonderful. Maximum kudos to the both of you.
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:31 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.04314 seconds
  • Memory Usage 2,257KB
  • 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
  • (2)bbcode_code
  • (2)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (3)post_thanks_box_bit
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete