Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tutorial] Strikethrough Closed Threads [Minor Code Tweak]
#1
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>
Reply
#2
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.
Reply
#3
I like Labrocca's way better since it requires less template editing meaning less changes that something will not work Toungue.

Thanks anyways!
Reply
#4
Same difference, its one filed edit, and one template add instead of css edit. So same difference. Only posted it as someone asked!
Reply
#5
Yes but with the template add it may break on any upgrades or new themes added.
Reply
#6
(11-18-2009, 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)
Reply
#7
labrocca,
your method it doesnt work for me. Please help.
Reply
#8
Probably did it wrong, try Aaron's
Reply
#9
This user has been denied support. This user has been denied support.
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
Reply
#10
(11-18-2009, 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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)