vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Add a word to the title of every new topic in a certain forum folder? (https://vborg.vbsupport.ru/showthread.php?t=282851)

charlesr 05-13-2012 07:01 AM

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.

Boofo 05-13-2012 08:09 AM

Why not just use thread prefixes? [Review] Sniper Elite

Badshah93 05-13-2012 08:25 AM

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.

charlesr 05-13-2012 06:24 PM

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.

Boofo 05-13-2012 06:34 PM

Check out the "Edit Selected Prefix Permissions" in the Thread Prefix Manager.

charlesr 05-15-2012 02:50 PM

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.

Badshah93 05-15-2012 02:59 PM

Quote:

Originally Posted by charlesr (Post 2329594)
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'];



kh99 05-15-2012 03:06 PM

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.

charlesr 05-16-2012 05:43 AM

Wonderful. Maximum kudos to the both of you.


All times are GMT. The time now is 11:19 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.01125 seconds
  • Memory Usage 1,736KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (2)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete