Articles List - How to show modified date

Need help with the Administration of your Joomla! 3.x site? This is the spot for you.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Locked
terrybanks
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Sat Jul 18, 2009 5:08 pm

Articles List - How to show modified date

Post by terrybanks » Sat May 24, 2014 7:01 pm

I want the "Article Manager: Articles" list of articles to show the modification date rather than the created date. How do I go about doing this? I have Joomla 3.3.0 using the isis administration template.

Thanks.

User avatar
kenmcd
Joomla! Champion
Joomla! Champion
Posts: 5672
Joined: Thu Aug 18, 2005 2:09 am
Location: California
Contact:

Re:Articles List- show modified date - admin layout override

Post by kenmcd » Sun May 25, 2014 6:50 am

 
I thought this would be relatively easy.
Should be able to do this with a layout override on the Article Manager.

I modified one article so it would have today's date in the Modified Date field.
But, when in the layout code I change created to modified ... it shows today's date on all articles listed. :eek:
The individual articles still have the correct modified date, but in the list the dates are displayed wrong.

Not sure what is going on there.
Have to sleep on that one.


Edit: this may be a bug in J3.3.1-dev - before any changes it shows the same date on all articles.
I do not think the sample data has the same Created Date on all articles.
Dunno. Maybe it does.
(edit - appears it does, which is just stupid)

Have to test with J3.2.4 tomorrow . . .

 
██ LibreTraining

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 25953
Joined: Mon Oct 27, 2008 9:27 pm
Location: Akershus, Norway

Re: Articles List - How to show modified date

Post by Per Yngve Berg » Sun May 25, 2014 8:01 am

The Changed Date does not exist in Article Manager. There is only one date and that is Created Date.
Tested with 3.3.0

User avatar
kenmcd
Joomla! Champion
Joomla! Champion
Posts: 5672
Joined: Thu Aug 18, 2005 2:09 am
Location: California
Contact:

Re: Articles List - How to show modified date

Post by kenmcd » Sun May 25, 2014 9:12 am

Per Yngve Berg wrote:The Changed Date does not exist in Article Manager. There is only one date and that is Created Date.
Tested with 3.3.0
OK.
But why is the modified date not in the admin com_content articles view?
It is displayed in the admin com_content article view.
It is displayed in the admin com_content edit view.

How is Joomla getting the modified date in those views, and not in the articles view?
Where does that come from and why only there?
I am trying to understand how it works.

 
██ LibreTraining

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 25953
Joined: Mon Oct 27, 2008 9:27 pm
Location: Akershus, Norway

Re: Articles List - How to show modified date

Post by Per Yngve Berg » Sun May 25, 2014 11:48 am

administrator/components/com_content/views/articles/view.html.php:

Code: Select all

protected function getSortFields()
	{
		return array(
			'a.ordering'     => JText::_('JGRID_HEADING_ORDERING'),
			'a.state'        => JText::_('JSTATUS'),
			'a.title'        => JText::_('JGLOBAL_TITLE'),
			'category_title' => JText::_('JCATEGORY'),
			'access_level'   => JText::_('JGRID_HEADING_ACCESS'),
			'a.created_by'   => JText::_('JAUTHOR'),
			'language'       => JText::_('JGRID_HEADING_LANGUAGE'),
			'a.created'      => JText::_('JDATE'),
			'a.id'           => JText::_('JGRID_HEADING_ID'),
			'a.featured'     => JText::_('JFEATURED')
		);
	}
There is no a.changed here.

diasf
Joomla! Apprentice
Joomla! Apprentice
Posts: 35
Joined: Wed Nov 27, 2013 10:06 am

Re: Articles List - How to show modified date

Post by diasf » Wed Jul 08, 2015 5:16 pm

"There is no a.changed here." (Per Yngve Berg)

Why not add it?

I had the same problem in J 2.5, and I solved the problem by adding the modified date into it. I'll tell how I did in J 2.5, I presume in J 3.x will be anything similar:

(BTW, it's not a.changed, it is a.modified)

In administrator/components/com_content/views/articles/tmpl/default.php

After these lines:
<th width="5%">
<?php echo JHtml::_('grid.sort', 'JDATE', 'a.created', $listDirn, $listOrder); ?>
</th>

Add these to create the new table heading:
<th width="5%">
<?php echo JHtml::_('grid.sort', 'Modif', 'a.modified', $listDirn, $listOrder); ?>
</th>

After these lines:
<td class="center nowrap">
<?php echo JHtml::_('date', $item->created, JText::_('DATE_FORMAT_LC4')); ?>
</td>

Add these to create the field to display the modified date:
<td class="center nowrap">
<?php if ($item->modified != '0000-00-00 00:00:00')
{
echo JHtml::_('date', $item->modified, JText::_('DATE_FORMAT_LC4'));
}?>
</td>

The "if ($item->modified != '0000-00-00 00:00:00')" is to show blank if there's no date

In administrator/components/com_content/models/articles.php

After
'created_by_alias', 'a.created_by_alias',

Add
'modified', 'a.modified',

In query select line add a.modified field
$query->select(
$this->getState(
'list.select',
'a.id, a.title, a.alias, a.checked_out, a.checked_out_time, a.catid' .
', a.state, a.access, a.created, a.created_by, a.created_by_alias, a.modified, a.ordering, a.featured, a.language, a.hits' .
', a.publish_up, a.publish_down'
)
);

That's all! Hope this helps.

maladd
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Mon Oct 20, 2008 8:18 pm

Re: Articles List - How to show modified date

Post by maladd » Tue Mar 22, 2016 8:32 pm

Thanks for the instructions - still useful years later.

I took this one step further and added the modified date to the sort criteria.

administrator/components/com_content/models/forms/filter_articles.xml
After line 110, I inserted
<option value="a.modified ASC">MODIF_ASC</option>
<option value="a.modified DESC">MODIF_DESC</option>

If I wanted to be really slick, I guess I would add MODIF_ASC and MODIF_DESC to the appropriate language file, but this gets me what I needed.

davidascher
Joomla! Intern
Joomla! Intern
Posts: 97
Joined: Tue Feb 28, 2006 3:23 pm

Re: Articles List - How to show modified date

Post by davidascher » Wed Jun 28, 2017 3:43 pm

I am attempting to do the same thing as described in this post... but I don't want to hack the core files if I can do this through an override in the admin template (I'm using a copy of isis). Is that possible?? or is it beyond the limits that one can implement in an overrride??


Locked

Return to “Administration Joomla! 3.x”