MyBB Community Forums

Full Version: [Tutorial] Strikethrough Closed Threads [Minor Code Tweak]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Here is a simple way.

Open forumdisplay.php

Find the line:
eval("\$threads .= \"".$templates->get("forumdisplay_thread")."\";");

Replace with:
				if($thread["closed"] == 1)
		{
		eval("\$threads .= \"".$templates->get("forumdisplay_closedthread")."\";");
		}
		else
		{
		eval("\$threads .= \"".$templates->get("forumdisplay_thread")."\";");
		}

Then go to Templates & Styles -> Templates -> Your Template Set, And add a template called.

forumdisplay_closedthread

With the following template inserted:

<tr>
	<td align="center" class="{$bgcolor}" width="2%"><img src="{$theme['imgdir']}/{$folder}.gif" alt="{$folder_label}" title="{$folder_label}" /></td>
	<td align="center" class="{$bgcolor}" width="2%">{$icon}</td>
	<td class="{$bgcolor}">
		{$attachment_count}
		<div>
			<span>{$prefix} {$gotounread}<s><a href="{$thread['threadlink']}" class="{$inline_edit_class} {$new_class}" id="tid_{$inline_edit_tid}">{$thread['subject']}</a></s>{$thread['multipage']}</span>
			<div class="author smalltext">{$thread['profilelink']}</div>
		</div>
	</td>
	<td align="center" class="{$bgcolor}"><a href="javascript:MyBB.whoPosted({$thread['tid']});">{$thread['replies']}</a>{$unapproved_posts}</td>
	<td align="center" class="{$bgcolor}">{$thread['views']}</td>
	{$rating}
	<td class="{$bgcolor}" style="white-space: nowrap; text-align: right;">
		<span class="lastpost smalltext">{$lastpostdate} {$lastposttime}<br />
		<a href="{$thread['lastpostlink']}">{$lang->lastpost}</a>: {$lastposterlink}</span>
	</td>
{$modbit}
</tr>
A better method imho would be to utilize the $newclass css.

if($thread["closed"] == 1)
 $newclass = "closedcss";

eval("\$threads .= \"".$templates->get("forumdisplay_thread")."\";"); 

Then add to the theme....

.closedcss {text-decoration: line-through;}

Personally I wish that MyBB would have more css options in the templates already for stuff like this. It would certainly make it easier to do custom themes with more diversity.

My tweak requires no template changes and few line edits.
I like Labrocca's way better since it requires less template editing meaning less changes that something will not work Toungue.

Thanks anyways!
Same difference, its one filed edit, and one template add instead of css edit. So same difference. Only posted it as someone asked!
Yes but with the template add it may break on any upgrades or new themes added.
(2009-11-18, 12:13 AM)labrocca Wrote: [ -> ]Personally I wish that MyBB would have more css options in the templates already for stuff like this. It would certainly make it easier to do custom themes with more diversity.

I agree with you there Labrocca. It'd be also nice that pages had classes on the body so you could style a lot more without having to edit templates.

At the topic: the idea is nice, I don't usually like to have locked threads within the other threads, so I'd just add a display: none instead of strikethrough. (But that might mess the tables, oh well)
labrocca,
your method it doesnt work for me. Please help.
Probably did it wrong, try Aaron's
i did not understand what does this tweak

¿Could anyone explain me please?

P.D i am native spanish so my english is not perfect
(2009-11-18, 05:42 PM)Glas Wrote: [ -> ]i did not understand what does this tweak

¿Could anyone explain me please?

P.D i am native spanish so my english is not perfect

Makes the thread striked when a admin or mods closes it.

Like:

This COULD be a closed topic on your forum with the edits on this thread
Pages: 1 2 3