Osclass forums
Development => Development => Topic started by: SmaRTeY 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
-
This is also happening in 3.7.1.
-
3.7.1:
/oc-includes/osclass/model/Alerts.php
put:
/**
* 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
/**
* 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.
-
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?
-
SmaRTeY, I nailed it.
A cron job to delete the unsubscribed alerts from db and admin.
-
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.
-
Welcome back.