MyBB Community Forums

Full Version: Time is showing below new threads, but not date
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello!

I am trying to display thread creation date and time next to author's name in the thread list. I followed another question/answer thread from a few years ago and it almost works...it's show the author's name and time of creation, but not the date.

This is the edited code in forumdisplay.php:

{
eval("\$threads .= \"".$templates->get("forumdisplay_sticky_sep")."\";");
$shownormalsep = true;
$donestickysep = true;
}
else if($thread['sticky'] == 0 && !empty($shownormalsep))
$threaddate = my_date($mybb->settings['dateformat'], $thread['dateline']);
        $threadtime = my_date($mybb->settings['timeformat'], $thread['dateline']);
{
eval("\$threads .= \"".$templates->get("forumdisplay_threads_sep")."\";");
$shownormalsep = false;
}


And the edited code in forumdisplay_thread template:

<div><if $thread['privatethread'] then><img src="/images/incognito3.png" /></if><if $thread['closed'] then><img src="/images/lockfinale.png" /></if>
          <span>{$prefix} {$gotounread}{$thread['threadprefix']}<span class="{$inline_edit_class} {$new_class}" id="tid_{$inline_edit_tid}"><a href="{$thread['threadlink']}">{$thread['subject']}</a></span>{$thread['multipage']}</span>
<div class="smalltext"> Created on: {$threaddate} at {$threadtime} by <em>{$thread['profilelink']}</em> </div>
</div>


Any suggestion on what to look at to make the date display also?

Thank you!
I think you have placed your modification in a wrong place. The variable declarations are under wrong condition, that too out of condition braces.

Add your 2 new variables declaration above this line (around line 1338):
$plugins->run_hooks("forumdisplay_thread_end");

[Image: Untitled.png]
(2019-09-20, 03:46 AM)effone Wrote: [ -> ]I think you have placed your modification in a wrong place. The variable declarations are under wrong condition, that too out of condition braces.

Add your 2 new variables declaration above this line (around line 1338):
$plugins->run_hooks("forumdisplay_thread_end");

[Image: Untitled.png]

Thank you. I see what you're saying. But, I tried it and now it's not showing time or date (or any of the "Created by" text), just the author's name. 

Do you have another suggestion?
Make sure you are doing the right modification at right place.
Check your template also, you need to modify your template which belongs to your currently applied theme.

I have just done your modification along with my suggested change, and the result is:

[Image: Untitled.png]
(2019-09-20, 04:05 AM)effone Wrote: [ -> ]Make sure you are doing the right modification at right place.
Check your template also, you need to modify your template which belongs to your currently applied theme.

I have just done your modification along with my suggested change, and the result is:

[Image: Untitled.png]

You are a rock star! I still had the code in the wrong spot. Works perfectly when I pay attention lol.

Thank you very much!