danielbidala VIP
Total posts: 153
27 Jul 2016 21:12

Hi Sergey!

In section settings (Events Parameters) registred users are set to get notifications and email alerts when record deleted or expired. My test registred user follow section and all records in it. Also auto subscribed for new records. Email alerts are turned on.

When other users delete record or record is expired test user doesn't get notification or email alert. Special users also are not notified or alerted when record deleted.

Any idea or seggustion?

Last Modified: 12 Oct 2016


Sergey
Total posts: 13,748
28 Jul 2016 05:19

danielbidala Email alerts are turned on.

Do you mean cron task is configured?


danielbidala VIP
Total posts: 153
28 Jul 2016 06:03

Yes, cron task is configured and users (registred and special) get notifications and email alerts about new record and record edited events!

Record expired:

Super users: get notification and get email alert Special users: no notification and no email alert Registred users: no notification and no email alerts

Record deleted:

Super users: no notification and no email alert Special users: no notification and no email alert Registred users: no notification and no email alerts


Sergey
Total posts: 13,748
28 Jul 2016 06:10

Record expired only received by record author. record deleted event is depricated. That is because there is no record to refference to.


danielbidala VIP
Total posts: 153
28 Jul 2016 06:17

I need get notification about record expired for all users.... is there any workaround?


Sergey
Total posts: 13,748
28 Jul 2016 06:24

I've change that. In deed I do not see why only author have to receive this notification.


danielbidala VIP
Total posts: 153
28 Jul 2016 06:29

When did you change that? I rolled back to version 8.688


Sergey
Total posts: 13,748
28 Jul 2016 06:51

Will be in next update today.


danielbidala VIP
Total posts: 153
28 Jul 2016 06:55

Thanks for your efforts... One more question: what is the difference between record edited and record extended events? I don't find any information about this...


Sergey
Total posts: 13,748
28 Jul 2016 14:04

Extended is when someone clicked on prolong record menu element.


danielbidala VIP
Total posts: 153
28 Jul 2016 15:27

Thanks for the update. Now other users get notification of expired records.

I think there is one problem yet if I read your code well: For example I set expire date for record one year from now. After one year if someone edit another record the event will be triggerd (the expire of other record that I set). But who edit the record won't get notification because he is the eventer. (I tested this behavior)

I think this should be modified yet. What's your opinion?


Sergey
Total posts: 13,748
02 Aug 2016 06:11

Expire event will be triggered when there is attempt to show expired article full view. It wount show but if expire alert was no sent, it will trigger an alert.


danielbidala VIP
Total posts: 153
02 Aug 2016 07:54

but if expire alert was no sent, it will trigger an alert

Is this mean there is other case(s) when expired alert can be triggered?

Am I right that the eventer won't be alerted?

I build an intranet site with few user and low traffic. Record full views won't be opened and users won't edit records often. But it's very important to send alerts about expired records.

In any case is there a way to send expired alerts automatically. For example provide a link which can be opened with cron once a day to check if there is expired records?

Please show me where can I find the function in the source that is responsible for check the expired records... I would like to create a php file which can be opened by cron.


Sergey
Total posts: 13,748
02 Aug 2016 12:55

danielbidala Am I right that the eventer won't be alerted?

that should not be the case. Becuase there is no eventer. Yes it is me who updated this article when it was expired but it is not me who expired this article unlike like edit for example.

danielbidala In any case is there a way to send expired alerts automatically. For example provide a link which can be opened with cron once a day to check if there is expired records?

Of course you can create your own task and run it through cron daily. I can create custom code for it for $20 and suggest you how to use it.


danielbidala VIP
Total posts: 153
02 Aug 2016 13:51

that should not be the case. Becuase there is no eventer. Yes it is me who updated this article when it was expired but it is not me who expired this article unlike like edit for example.

I will test this again but it seemed expire event was triggered when I created or edited another record and in that case I DIDN'T GET notification of expired record as eventer!

OK Sergey, thanks for your offering. I pay $20 for your custom code and instructions for use. Please show me the way where to transfer or how to pay.


Sergey
Total posts: 13,748
09 Aug 2016 05:59

Create file components/com_cobalt/controllers/custom.php and place following there.

<?php

defined('_JEXEC') or die();

jimport('joomla.application.component.controllerbase');

class CobaltControllerCustom extends JControllerLegacy
{
    public function expirealerts()
    {
        $db = JFactory::getDbo();

        $db->setQuery("SELECT * FROM `#__js_res_record` WHERE exalert = 0 AND extime < NOW()");
        $records = $db->loadObjectList();

        foreach($records AS $record)
        {
            $type = ItemsStore::getType($record->type_id);

            $sql = "UPDATE #__js_res_record SET exalert = 1";
            if($type->params->get('properties.item_expire_access'))
            {
                $sql .= ", access = " . $type->params->get('properties.item_expire_access');
            }
            $sql .= " WHERE id = " . $record->id;

            $db->setQuery($sql);
            $db->execute();

            CEventsHelper::notify('record', CEventsHelper::_RECORD_EXPIRED, $record->id, $record->section_id, 0, 0, 0, $record, 2);
        }
    }
}

now you can create cron and call URL with wget or cron

http://[yoursite]/index.php?option=com_cobalt&task=custom.expirealerts&Itemid=1&lang=en

danielbidala VIP
Total posts: 153
14 Aug 2016 19:55

Thanks Sergey, I will test it shortly and let you know if everything is all right or not :) Please let me know how to transfer the money. Do you have paypal account? If yes, give me email address to transfer!


Jeff VIP
Total posts: 745
16 Aug 2016 00:02

Sergey Create file components/com_cobalt/controllers/custom.php and place following there.

+1


danielbidala VIP
Total posts: 153
16 Aug 2016 09:12

Thanks Sergey. I sent the money via paypal from my email address


Sergey
Total posts: 13,748
16 Aug 2016 13:01

Thank you.


danielbidala VIP
Total posts: 153
30 Sep 2016 12:46

Hello Sergey!

Now I tried to test this function but if I copy http://[yoursite]/index.php?option=com_cobalt&task=custom.expirealerts&Itemid=1&lang=en to the browser I get the following error message: 0 Invalid controller class: CobaltControllerCustom

Any idea?

Powered by Cobalt