1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 20:58:30 +01:00

Fixes #721 - jump to "last forum post" link added to 'Last Post' time value.

This commit is contained in:
Cameron 2015-04-25 14:03:54 -07:00
parent 542b30892f
commit b78fb35be2
4 changed files with 34 additions and 12 deletions

View File

@ -385,8 +385,15 @@ function parse_forum($f, $restricted_string = '')
{
$lastpost_name = $tp->toHTML($f['forum_lastpost_user_anon']);
}
$lastpost = $forum->threadGetLastpost($lastpost_thread); //XXX TODO inefficient to have SQL query here.
$fVars->LASTPOSTUSER = $lastpost_name;
$fVars->LASTPOSTDATE .= $gen->computeLapse($lastpost_datestamp, time(), false, false, 'short');
// {forum_sef}/{thread_id}-{thread_sef}
$urlData = array('forum_sef'=>$f['forum_sef'], 'thread_id'=>$lastpost['post_thread'],'thread_sef'=>$lastpost['thread_sef']);
$url = e107::url('forum', 'topic', $urlData)."?last=1#post-".$lastpost['post_id'];
$fVars->LASTPOSTDATE .= "<a href='".$url."'>". $gen->computeLapse($lastpost_datestamp, time(), false, false, 'short')."</a>";
$lastpost_datestamp = $gen->convert_date($lastpost_datestamp, 'forum');
$fVars->LASTPOST = $lastpost_datestamp.'<br />'.$lastpost_name." <a href='".$e107->url->create('forum/thread/last', array('name' => $lastpost_name, 'id' => $lastpost_thread))."'>".IMAGE_post2.'</a>';

View File

@ -343,7 +343,7 @@ if(deftrue('NEW_FORUMADMIN'))
{
$new_data['forum_sef'] = eHelper::title2sef($new_data['forum_name']);
}
return $new_data;
}

View File

@ -1551,11 +1551,13 @@ class e107forum
$sql = e107::getDb();
$forumId = (int)$forumId;
$qry = "
SELECT t.*, f.forum_id, f.forum_sef, u.user_name, lpu.user_name AS lastpost_username from `#forum_thread` as t
SELECT t.*, f.forum_id, f.forum_sef, u.user_name, lpu.user_name AS lastpost_username, MAX(p.post_id) AS lastpost_id FROM `#forum_thread` as t
LEFT JOIN `#forum` AS f ON t.thread_forum_id = f.forum_id
LEFT JOIN `#forum_post` AS p ON t.thread_id = p.post_thread
LEFT JOIN `#user` AS u ON t.thread_user = u.user_id
LEFT JOIN `#user` AS lpu ON t.thread_lastuser = lpu.user_id
WHERE t.thread_forum_id = {$forumId}
GROUP BY thread_id
ORDER BY
t.thread_sticky DESC,
t.thread_lastpost DESC
@ -1579,7 +1581,8 @@ class e107forum
$sql = e107::getDb();
$id = (int)$id;
$qry = "
SELECT p.post_user, p.post_user_anon, p.post_datestamp, p.post_thread, u.user_name FROM `#forum_post` AS p
SELECT p.post_user, p.post_id, p.post_user_anon, p.post_datestamp, p.post_thread, t.thread_sef, u.user_name FROM `#forum_post` AS p
LEFT JOIN `#forum_thread` AS t ON p.post_thread = t.thread_id
LEFT JOIN `#user` AS u ON u.user_id = p.post_user
WHERE p.post_thread = {$id}
ORDER BY p.post_datestamp DESC LIMIT 0,1

View File

@ -438,7 +438,15 @@ function parse_thread($thread_info)
}
}
$tVars->LASTPOST .= '<br />'.$lastpost_datestamp;
$tVars->LASTPOSTDATE .= $gen->computeLapse($thread_info['thread_lastpost'],time(), false, false, 'short');
$tVars->LASTPOSTUSER = $thread_info['lastpost_username']; // $lastpost_name;
$urlData = array('forum_sef'=>$thread_info['forum_sef'], 'thread_id'=>$thread_info['thread_id'],'thread_sef'=>$thread_info['thread_sef']);
$url = e107::url('forum', 'topic', $urlData);
$url .= (strpos($url,'?')!==false) ? '&' : '?';
$url .= "last=1#post-".$thread_info['lastpost_id'];
$tVars->LASTPOSTDATE .= "<a href='".$url."'>". $gen->computeLapse($thread_info['thread_lastpost'],time(), false, false, 'short')."</a>";
}
$newflag = (USER && $thread_info['thread_lastpost'] > USERLV && !in_array($thread_info['thread_id'], $threadsViewed));
@ -767,8 +775,10 @@ function fpages($thread_info, $replies)
{
$aa = $a + 1;
$text .= $text ? ' ' : '';
$urlparms['page'] = $aa;
$url = e107::getUrl()->create('forum/thread/view', $urlparms);
// $urlparms['page'] = $aa;
// $url = e107::getUrl()->create('forum/thread/view', $urlparms);
$url = e107::url('forum','topic',$urlparms).'?p='.$aa;
$opts[] = "<a data-toggle='tooltip' title=\"Go to Page $aa\" href='{$url}'>{$aa}</a>"; //FIXME LAN_GOPAGE syntax?
}
$text .= ' ... ';
@ -776,8 +786,9 @@ function fpages($thread_info, $replies)
{
$aa = $a + 1;
$text .= $text ? ' ' : '';
$urlparms['page'] = $aa;
$url = e107::getUrl()->create('forum/thread/view', $urlparms);
// $urlparms['page'] = $aa;
// $url = e107::getUrl()->create('forum/thread/view', $urlparms);
$url = e107::url('forum','topic',$urlparms).'?p='.$aa;
$opts[] = "<a data-toggle='tooltip' title=\"Go to Page $aa\" href='{$url}'>{$aa}</a>"; //FIXME LAN_GOPAGE syntax?
}
}
@ -787,12 +798,13 @@ function fpages($thread_info, $replies)
{
$aa = $a + 1;
$text .= $text ? ' ' : '';
$urlparms['page'] = $aa;
$url = e107::getUrl()->create('forum/thread/view', $urlparms);
// $urlparms['page'] = $aa;
// $url = e107::getUrl()->create('forum/thread/view', $urlparms);
$url = e107::url('forum','topic',$urlparms).'?p='.$aa;
$opts[] = "<a data-toggle='tooltip' title=\"Go to Page $aa\" href='{$url}'>{$aa}</a>"; //FIXME LAN_GOPAGE syntax?
}
}
if(deftrue('BOOTSTRAP'))
{
$text = "<ul class='pagination pagination-sm forum-viewforum-pagination'>