PDA

View Full Version : Add a word to the title of every new topic in a certain forum folder?


charlesr
05-13-2012, 07:01 AM
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:
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:

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
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:

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:

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.