Advertisement:

Author Topic: Alerts in Admin  (Read 1229 times)

SmaRTeY

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2519
Alerts in Admin
« on: November 07, 2015, 02:38:24 pm »
Hi there,

I dug a little deeper into the Alerts and the way it is setup at the moment. Correct me if I am wrong, at this moment Alerts are created by our users but when a user 'removes' one of his/her alerts what really happens is that the Alert for this user is getting an 'unsubscibe' date. The actual Alert is not removed from DB but for the user it is no longer active/working.

Okay, in Admin we keep seeing ALL the Alerts, the ones active as well as the ones deleted/removed by our users BUT in Admin all are 'active' which I think should not be the case since the user removed the alert. At least the alert 'Active' property should be set to inactive imo if a user 'removes' an Alert so Admins know it is NOT in use. How else would Admin know what Alerts can be 'removed' without surprising the owner of the Alert? 8)

Regards,
Eric

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: Alerts in Admin
« Reply #1 on: April 28, 2017, 03:36:47 pm »
This is also happening in 3.7.1.

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: Alerts in Admin
« Reply #2 on: April 28, 2017, 11:11:16 pm »
3.7.1:
/oc-includes/osclass/model/Alerts.php

put:
Code: [Select]

        /**
         * Unsub from an alert + deactivate + rename email to 'deleted'
         *
         * @access public
         * @since 3.1
         * @param string $id
         * @return mixed false on fail, int of num. of affected rows
         */
        function unsub($id)
        {   $this->dao->update($this->getTableName(), array('s_email' => 'deleted'), array('pk_i_id' => $id));
            $this->dao->update($this->getTableName(), array('b_active' => 0), array('pk_i_id' => $id));
            return $this->dao->update($this->getTableName(), array('dt_unsub_date' => date("Y-m-d H:i:s")), array('pk_i_id' => $id));
        }
instead of
Code: [Select]
        /**
         * Unsub from an alert
         *
         * @access public
         * @since 3.1
         * @param string $id
         * @return mixed false on fail, int of num. of affected rows
         */
        function unsub($id)
        {   
            return $this->dao->update($this->getTableName(), array('dt_unsub_date' => date("Y-m-d H:i:s")), array('pk_i_id' => $id));
        }

In this way you can search for deleted and delete more than one at once.

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: Alerts in Admin
« Reply #3 on: June 28, 2017, 10:25:59 pm »
Sorry to dig this up, but what if the user deletes the alert from the db?

Would this affect the osclass script in any way?

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: Alerts in Admin
« Reply #4 on: January 05, 2018, 01:21:32 pm »
SmaRTeY, I nailed it.
A cron job to delete the unsubscribed alerts from db and admin.

SmaRTeY

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2519
Re: Alerts in Admin
« Reply #5 on: May 15, 2018, 11:35:56 pm »
Cool, that sounds like a way to keep your DB's integrity optimal in sync with reality and I for one do not have any use for disabled alerts which for the user looks like they are deleted… However, I would prefer a direct removal of the alert in Osclass core or an Admin option to chose either keep or delete.

Regards,
Eric

SmaRTeY, I nailed it.
A cron job to delete the unsubscribed alerts from db and admin.

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: Alerts in Admin
« Reply #6 on: May 16, 2018, 09:25:04 pm »
Welcome back.