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

Closes #2558 - Date format option added to forum shortcode.

This commit is contained in:
Cameron
2017-04-12 11:00:13 -07:00
parent 92323408dd
commit 51c978addc

View File

@@ -431,38 +431,6 @@ class forum_shortcodes extends e_shortcode
function sc_lastpost($parm = null)
{
/*
if(!empty($parm['type']))
{
switch($parm['type'])
{
case "date": // date only
// code
break;
case "datelink": // date with link
return $this->lastpostdata('date');
break;
case "url": // url
return $this->lastpostdata('url');
break;
case "username": // username of last-post user.
return $this->lastpostdata('user');
break;
case "name": //thread name
// code
break;
}
}
return $this->lastpostdata('post');
*/
if (empty($this->var['forum_lastpost_info']))
{
return false;
@@ -479,7 +447,11 @@ class forum_shortcodes extends e_shortcode
$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>";
$relativeDate = e107::getParser()->toDate($lastpost_datestamp,'relative');
$format = !empty($options['date-format']) ? $options['date-format'] : 'relative';
$relativeDate = e107::getParser()->toDate($lastpost_datestamp, $format);
if(!empty($parm['type']))
{