Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Setting "Handle Old Evens"

Setting "Handle Old Evens" 1 year 1 month ago #24805

  • hekla
  • hekla's Avatar Topic Author
  • Offline
  • Expert Boarder
  • Expert Boarder
  • Posts: 137
  • Karma: 8
  • Thank you received: 66
Hi there

In the setting "Handle Old Evens" I have the choice between:
  • Do nothing
  • Delete old events
  • Archive old events
  • Trash old events
I would like to add
  • Deactivate old events
    or
  • Unpublish old events
This is usefull when I want to reuse the events, but I want to prevent visitors to still find them in the archive.

As I can see this an easy change:

in components/com_jem/helpers/helper.php add after line 266 (//Set state trashed of outdated events) and before line 268 (// Set timestamp of last cleanup)
//Set state unpublished of outdated events
				if ($jemsettings->oldevent == 4) {
					$query = 'UPDATE #__jem_events SET published = 0 WHERE dates > 0 AND '
					       .' DATE_SUB(NOW(), INTERVAL '.(int)$jemsettings->minus.' DAY) > (IF (enddates IS NOT NULL, enddates, dates)) '
					       .' AND published = 1';
					$db->SetQuery($query);
					$db->execute();
				}

in administrator/components/com_jem/models/forms/settings.xml after line 323 (<option value="1">COM_JEM_DELETE_OLD_EVENTS</option>)
add
<option value="4">COM_JEM_UNPUBLISH_OLD_EVENTS</option>

and in the language file administrator/components/com_jem/language/en-GB/en-GB.com_jem.ini add after line 848 (COM_JEM_TRASH_OLD_EVENTS="Trash old events")
add
COM_JEM_UNPUBLISH_OLD_EVENTS="Unpublish old events"

The only thing I couldn't figure out in this quick hack is where to modify the javascript that it displays the connected field "number of days" …
JEM 2.2.3 / JEM 2.2.3 with core mods (custom fields) / 2.3dev (Egnarts Version)
Joomla always up to date
php 7.2/7.3

Please Log in or Create an account to join the conversation.

Setting "Handle Old Evens" 1 year 1 month ago #24806

  • hekla
  • hekla's Avatar Topic Author
  • Offline
  • Expert Boarder
  • Expert Boarder
  • Posts: 137
  • Karma: 8
  • Thank you received: 66
Ok, I got the javascript:

in administrator/components/com_jem/views/settings/tmpl/default.php change line 204 from
if (nrevhandler == 1 || nrevhandler == 2 || nrevhandler == 3) {
to

if (nrevhandler == 1 || nrevhandler == 2 || nrevhandler == 3 || nrevhandler == 4) {

or you create a template overrride and do the changes there – better practice since it results in less core hacking.
JEM 2.2.3 / JEM 2.2.3 with core mods (custom fields) / 2.3dev (Egnarts Version)
Joomla always up to date
php 7.2/7.3

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.198 seconds

Donate

If you find JEM useful and if you use it on your site, please consider a donation to the project.

Private Messages

You are not logged in.

Follow us......