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

TOPIC:

Setting "Handle Old Events" 5 years 8 months ago #24805

  • hekla
  • hekla's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
  • Posts: 364
  • Thank you received: 182
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" …
The following user(s) said Thank You: benno

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

Setting "Handle Old Events" 5 years 8 months ago #24806

  • hekla
  • hekla's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
  • Posts: 364
  • Thank you received: 182
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.

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

Setting "Handle Old Events" 2 years 8 months ago #27906

Thanks a lot, @hekla

Just added a feature request for this www.joomlaeventmanager.net/forum/feature...-events-option#27905 and a PR github.com/jemproject/JEM-Project/pull/1234

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

Setting "Handle Old Events" 2 years 8 months ago #27947

@ShannonBerry - as you see in my pull request ( github.com/jemproject/JEM-Project/pull/1...ject/pull/1234/files ), there is a second line to be modified in the javascript on line 109.

Moreover the code could be shortened to
if (nrevhandler > 0) {
(I just committed this modification)

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

  • Page:
  • 1
Time to create page: 0.428 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......