1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-18 05:09:05 +01:00

Use 'Anonymous' as username when no name was entered in anonymous forum post

This commit is contained in:
Tijn Kuyper 2019-10-24 16:44:43 +02:00
parent ad83dea61a
commit 05bf1ad645
No known key found for this signature in database
GPG Key ID: AAEA3CC2C5A308F2

View File

@ -501,7 +501,22 @@ class forum_shortcodes extends e_shortcode
$lastpost = $forum->threadGetLastpost($lastpost_thread); //FIXME TODO inefficient to have SQL query here.
$urlData = array('forum_sef'=>$this->var['forum_sef'], 'thread_id'=>$lastpost['post_thread'],'thread_sef'=>$lastpost['thread_sef']);
$url = e107::url('forum', 'topic', $urlData)."?last=1#post-".$lastpost['post_id'];
$lastpost_username = empty($this->var['user_name']) ? e107::getParser()->toHTML($this->var['forum_lastpost_user_anon']) : "<a href='".e107::url('user/profile/view', array('name' => $this->var['user_name'], 'id' => $this->var['forum_lastpost_user']))."'>{$this->var['user_name']}</a>";
// Registered user
if(!empty($this->var['user_name']))
{
$lastpost_username = "<a href='".e107::url('user/profile/view', array('name' => $this->var['user_name'], 'id' => $this->var['forum_lastpost_user']))."'>{$this->var['user_name']}</a>";
}
// Anonymous but with a custom name entered
elseif(empty($this->var['user_name']) && $this->var['forum_lastpost_user_anon'])
{
$lastpost_username = e107::getParser()->toHTML($this->var['forum_lastpost_user_anon']);
}
// Anonymous with no name entered
else
{
$lastpost_username = LAN_ANONYMOUS;
}
$format = !empty($parm['date-format']) ? $parm['date-format'] : 'relative';