Skip to content

Commit

Permalink
Add variable to get topic last edit date
Browse files Browse the repository at this point in the history
  • Loading branch information
samerton committed Oct 25, 2018
1 parent 02abc0f commit 6cf8923
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions modules/Forum/pages/forum/view_topic.php
Expand Up @@ -170,12 +170,18 @@
require_once(ROOT_PATH . '/core/templates/frontend_init.php');

// Assign author + title to Smarty variables
// Get first post
$first_post = $queries->orderWhere('posts', 'topic_id = ' . $tid, 'id', 'ASC LIMIT 1');
$first_post = $first_post[0];

$smarty->assign(array(
'TOPIC_TITLE' => Output::getClean($topic->topic_title),
'TOPIC_AUTHOR_USERNAME' => Output::getClean($user->idToName($topic->topic_creator)),
'TOPIC_AUTHOR_MCNAME' => Output::getClean($user->idToName($topic->topic_creator)),
'TOPIC_ID' => $topic->id,
'FORUM_ID' => $topic->forum_id
'FORUM_ID' => $topic->forum_id,
'TOPIC_LAST_EDITED' => ($first_post->last_edited ? $timeago->inWords(date('d M Y, H:i', $first_post->last_edited), $language->getTimeLanguage()) : null),
'TOPIC_LAST_EDITED_FULL' => ($first_post->last_edited ? date('d M Y, H:i', $first_post->last_edited) : null)
));

// Get all posts in the topic
Expand Down Expand Up @@ -401,7 +407,6 @@
$smarty->assign('LOCKED', true);

// Is the user a moderator?
$buttons = '<span class="pull-right">';
if($user->isLoggedIn() && $forum->canModerateForum($group_id, $forum_parent[0]->id, $secondary_groups)){
$smarty->assign(array(
'CAN_MODERATE' => true,
Expand Down

0 comments on commit 6cf8923

Please sign in to comment.