Unpublish expired articles

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.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Locked
cxn
Joomla! Apprentice
Joomla! Apprentice
Posts: 17
Joined: Sun Mar 17, 2013 9:20 pm

Unpublish expired articles

Post by cxn » Fri Jan 16, 2015 9:08 pm

Hi All,

First of all I love Joomla! 3.3. Great Job.

I'm encountering one problem.
When an article is expired (reaches the "Finish Publishing" date) it hides these articles for all users in "Featured Articles", except for "Super Users".

I know this is default on how Joomla! works (http://forum.joomla.org/viewtopic.php?p=2250654), but I want these articles to be hidden for all access levels.

Also "AutoArchive" (http://extensions.joomla.org/extensions ... utoarchive) is not for me, I don't want to move between categories.

Is there any solution? (rather than updating it through phpmyadmin to unpublished)

Thanks :D

cxn
Joomla! Apprentice
Joomla! Apprentice
Posts: 17
Joined: Sun Mar 17, 2013 9:20 pm

Re: Unpublish expired articles

Post by cxn » Thu Jan 22, 2015 9:16 pm

Anyone knows how to hide "expired articles" for Super User in the featured articles menu?

I only found this in featured/default_item.php:

Code: Select all

<?php if ((strtotime($this->item->publish_down) < strtotime(JFactory::getDate())) && $this->item->publish_down != '0000-00-00 00:00:00') : ?>
	<span class="label label-warning"><?php echo JText::_('JEXPIRED'); ?></span>
<?php endif; ?>
But thats only the warning.

Thanks

cxn
Joomla! Apprentice
Joomla! Apprentice
Posts: 17
Joined: Sun Mar 17, 2013 9:20 pm

Re: Unpublish expired articles

Post by cxn » Wed Jan 28, 2015 1:37 pm

Anyone? :(

Tuscany
Joomla! Apprentice
Joomla! Apprentice
Posts: 17
Joined: Sun Apr 23, 2006 8:57 am

Re: Unpublish expired articles

Post by Tuscany » Wed Mar 18, 2015 12:17 pm

need this aswell !
Please someone !

User avatar
NathanHawks
Joomla! Ace
Joomla! Ace
Posts: 1900
Joined: Wed Oct 02, 2013 6:17 pm
Location: Washington state, U.S.
Contact:

Re: Unpublish expired articles

Post by NathanHawks » Wed Mar 18, 2015 5:40 pm

Here is a general guide. You need to override the template. You'll be modifying PHP logic. For example in the template com_content/category/default_articles.php on line 108 is the loop going through the stories. Inside that loop, on line ...

...hang on, am I looking at tables code? There are still HTML tables in the freaking blog layout code in twentyfif--

...anyway, on line 144 we see a test for an expired story.

By copying and reusing that test, we could skip entries in the loop. So if you inserted at the end of line 108:

Code: Select all

<?php if ((strtotime($article->publish_down) < strtotime(JFactory::getDate())) && $article->publish_down != '0000-00-00 00:00:00') { continue; } ?>
...you can conditionally "continue" upon that test, which would skip the entire rendering process for that story, continuing the loop at the next story.

That would cover you for a category blog... for any component or any view of a component, you now know what to look for.

Creating overrides
Save time - hire me for your Joomla to-do list! http://nathanhawks.us/joomla


Locked

Return to “Administration Joomla! 3.x”