MyBB Community Forums

Full Version: Set prefix by time?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is it possible to set a time for a prefix?

I wanna make possible for the staff to make prefix of threads that are new.
So I set a prefix that is [NEW] on a thread, but this [NEW] will disappear in like 3 days or so, as it ain't new anymore.

How do I do this? any plugin or something?
It's a great idea and I think it can be done with conditional.
Please D666 could you come up with a conditional that will do this:

< if {$post['postdate']} < 3 then>Code here<else>Code here</if>
You can try adding:
<if TIME_NOW - $thread['dateline'] < 60*60*24*3 then><span class="newprefix">NEW</span></if>
in forumdisplay_thread template before/after {$prefix}. Change 3 to number of days. Add .newprefix to global.css to style it.

You may also need to add similar code to other templates (showthread, search) if you want them there too.

As marcus123 mentioned, Template Conditionals http://mybbhacks.zingaburga.com/showthread.php?tid=464 plugin is required.
i cant use this code as

<if TIME_NOW - $thread['dateline'] < 60*60*24*7 then><span class="newprefix">NEW</span></if>

my code is

<span>{$mysupport_status}{$mysupport_bestanswer}{$mysupport_assigned}{$prefix} {$gotounread}{$thread['threadprefix']}<a href="{$thread['threadlink']}" class="{$inline_edit_class} {$new_class}" id="tid_{$inline_edit_tid}">{$thread['subject']}</a>{$thread['multipage']}</span>

how to add this?
This will show NEW before Thread Prefix

<span>{$mysupport_status}{$mysupport_bestanswer}{$mysupport_assigned}<if TIME_NOW - $thread['dateline'] < 60*60*24*7 then><span class="newprefix">NEW</span></if>{$prefix} {$gotounread}{$thread['threadprefix']}<a href="{$thread['threadlink']}" class="{$inline_edit_class} {$new_class}" id="tid_{$inline_edit_tid}">{$thread['subject']}</a>{$thread['multipage']}</span>

This will show NEW after Thread Prefix

<span>{$mysupport_status}{$mysupport_bestanswer}{$mysupport_assigned}{$prefix}<if TIME_NOW - $thread['dateline'] < 60*60*24*7 then><span class="newprefix">NEW</span></if> {$gotounread}{$thread['threadprefix']}<a href="{$thread['threadlink']}" class="{$inline_edit_class} {$new_class}" id="tid_{$inline_edit_tid}">{$thread['subject']}</a>{$thread['multipage']}</span>

Add this code to your global.css

.newprefix {
    color: #0B610B;
    font-weight: bold;
}

D666 Dude thanks very much for this amazing conditional +1 I wish I could add more