1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 20:00:37 +02:00

#2785 NewForumPosts Menu shortcode fixes.

This commit is contained in:
Cameron
2017-09-22 12:47:37 -07:00
parent 9636d988a9
commit 3001462e7b
3 changed files with 69 additions and 11 deletions

View File

@@ -48,12 +48,14 @@ if(!class_exists('forum_newforumposts_menu'))
p.post_user, p.post_id, p.post_datestamp, p.post_user_anon, p.post_entry, p.post_user, p.post_id, p.post_datestamp, p.post_user_anon, p.post_entry,
t.*, t.*,
u.user_id, u.user_name, u.user_image, u.user_currentvisit, u.user_id, u.user_name, u.user_image, u.user_currentvisit,
lu.user_name as thread_lastuser_username,
f.forum_name, f.forum_sef f.forum_name, f.forum_sef
FROM `#forum_post` as p FROM `#forum_post` as p
LEFT JOIN `#forum_thread` AS t ON t.thread_id = p.post_thread LEFT JOIN `#forum_thread` AS t ON t.thread_id = p.post_thread
LEFT JOIN `#forum` as f ON f.forum_id = t.thread_forum_id LEFT JOIN `#forum` as f ON f.forum_id = t.thread_forum_id
LEFT JOIN `#user` AS u ON u.user_id = p.post_user LEFT JOIN `#user` AS u ON u.user_id = p.post_user
LEFT JOIN `#user` AS lu ON t.thread_lastuser = lu.user_id
WHERE {$max_age} p.post_forum IN ({$forumList}) WHERE {$max_age} p.post_forum IN ({$forumList})
ORDER BY p.post_datestamp DESC LIMIT 0, ".vartrue($this->menuPref['display'],10); ORDER BY p.post_datestamp DESC LIMIT 0, ".vartrue($this->menuPref['display'],10);
@@ -83,7 +85,7 @@ if(!class_exists('forum_newforumposts_menu'))
$layout = 'default'; $layout = 'default';
} }
if(!empty($this->menuPref['layout']))//@todo e_menu add 'layout' dropdown. if(!empty($this->menuPref['layout'])) // @see e_menu
{ {
$layout = $this->menuPref['layout']; $layout = $this->menuPref['layout'];
} }
@@ -190,7 +192,7 @@ if(!class_exists('forum_newforumposts_menu'))
$list .= $tp->parseTemplate($template['end'], true); $list .= $tp->parseTemplate($template['end'], true, $sc);
$text = $list; $text = $list;

View File

@@ -39,6 +39,8 @@
* Only by nfp menu at this time. * Only by nfp menu at this time.
*/ */
// @todo new post shortcodes
function sc_post_url($parm=null) function sc_post_url($parm=null)
{ {
$url = e107::url('forum', 'topic', $this->var, array( $url = e107::url('forum', 'topic', $this->var, array(
@@ -81,13 +83,14 @@
return $this->sc_avatar($parm); return $this->sc_avatar($parm);
} }
// thread/topic // @todo new thread/topic shortcodes
function sc_topic_name($parm=null) function sc_topic_name($parm=null)
{ {
return $this->sc_threadname($parm); return $this->sc_threadname($parm);
} }
function sc_topic_url($parm=null) function sc_topic_url($parm=null)
{ {
return e107::url('forum', 'topic', $this->var); return e107::url('forum', 'topic', $this->var);
@@ -109,11 +112,69 @@
function sc_topic_lastpost_date($parm=null) function sc_topic_lastpost_date($parm=null)
{ {
$mode = empty($parm['format']) ? 'forum' : $parm['format'];
return e107::getParser()->toDate($this->var['thread_lastpost'], $mode);
}
function sc_topic_lastpost_author($parm=null)
{
if($this->var['thread_views'] || $this->var['thread_total_replies'] > 0)
{
if($this->var['thread_lastuser_username'])
{
$url = e107::getUrl()->create('user/profile/view', "name={$this->var['thread_lastuser_username']}&id={$this->var['thread_lastuser']}");
return "<a href='{$url}'>" . $this->var['thread_lastuser_username'] . "</a>";
}
elseif($this->var['thread_lastuser_anon'])
{
return e107::getParser()->toHTML($this->var['thread_lastuser_anon']);
}
else
{
return LAN_FORUM_1015;
}
}
} }
// forum
function sc_topic_icon($parm=null)
{
$newflag = (USER && $this->var['thread_lastpost'] > USERLV && !in_array($this->var['thread_id'], $this->forum->threadGetUserViewed()));
$ICON = ($newflag ? IMAGE_new : IMAGE_nonew);
if($this->var['thread_total_replies'] >= vartrue($this->pref['popular'], 10))
{
$ICON = ($newflag ? IMAGE_new_popular : IMAGE_nonew_popular);
}
elseif(empty($this->var['thread_total_replies']) && defined('IMAGE_noreplies'))
{
$ICON = IMAGE_noreplies;
}
if($this->var['thread_sticky'] == 1)
{
$ICON = ($this->var['thread_active'] ? IMAGE_sticky : IMAGE_stickyclosed);
}
elseif($this->var['thread_sticky'] == 2)
{
$ICON = IMAGE_announce;
}
elseif(!$this->var['thread_active'])
{
$ICON = IMAGE_closed;
}
return $ICON;
}
// @todo new forum shortcodes
function sc_forum_name($parm=null) function sc_forum_name($parm=null)
{ {
@@ -148,11 +209,6 @@
function sc_breadcrumb() function sc_breadcrumb()
{ {
return $this->var['breadcrumb']; return $this->var['breadcrumb'];

View File

@@ -46,8 +46,8 @@
</tr>"; </tr>";
$NEWFORUMPOSTS_MENU_TEMPLATE['main']['item'] = "<tr> $NEWFORUMPOSTS_MENU_TEMPLATE['main']['item'] = "<tr>
<td style='width:5%; text-align:center' class='forumheader3'>{ICON}</td> <td style='width:5%; text-align:center' class='forumheader3'>{TOPIC_ICON}</td>
<td style='width:45%' class='forumheader3'><a href='{TOPIC_URL}'>{TOPIC_NAME}</a> <small class='smalltext'>(<a href='{FORUM_URL}'>{FORUM_NAME}</a>)</small></td> <td style='width:45%' class='forumheader3'><a href='{POST_URL}'>{TOPIC_NAME}</a> <small class='smalltext'>(<a href='{FORUM_URL}'>{FORUM_NAME}</a>)</small></td>
<td style='width:15%; text-align:center' class='forumheader3'>{POST_AUTHOR_NAME}</td> <td style='width:15%; text-align:center' class='forumheader3'>{POST_AUTHOR_NAME}</td>
<td style='width:5%; text-align:center' class='forumheader3'>{TOPIC_VIEWS}</td> <td style='width:5%; text-align:center' class='forumheader3'>{TOPIC_VIEWS}</td>
<td style='width:5%; text-align:center' class='forumheader3'>{TOPIC_REPLIES}</td> <td style='width:5%; text-align:center' class='forumheader3'>{TOPIC_REPLIES}</td>