Is it possible to show the date an article was originally submitted and the date it was accepted (on the public interface, I mean)? I thought there might be an option to do this, or a plug-in, or perhaps it could be done in the theme?
Sorry if I’m missing something obvious, but I can’t see this feature if it is there!
Hi @matthewbarr,
That information isn’t currently included in the templates, but it would make a very quick modification; you’d need to call $article->getDateSubmitted()
to get the information you’re looking for.
Regards,
Alec Smecher
Public Knowledge Project Team
1 Like
Thanks @asmecher - I’ll try adding that to my template!
In case anyone else is trying to do the same thing, here’s what I did. This works but is probably far from best practice:
Add functions to /classes/article/Article.inc.php:
function getFormattedDateSubmitted() {
return date('j F Y', strtotime($this->getDateSubmitted()));
}
function getFormattedDatePublished() {
return date('j F Y', strtotime($this->getDatePublished()));
}
}
Add following to /templates/article/article.tpl:
<br />
{if $article->getFormattedDateSubmitted()}
<div id="dateSubmitted">
<div style="color: #808080;">Received {$article->getFormattedDateSubmitted()|escape}, published online {$article->getFormattedDatePublished()|escape}</div>
</div>
{/if}
Hi @matthewbarr,
Glad you got it going! You can probably do this entirely inside the templates using Smarty modifiers, by the way.
Regards,
Alec Smecher
Public Knowledge Project Team