ElkArte Community

Elk Development => Feature Discussion => Topic started by: badmonkey on June 04, 2017, 12:04:17 am

Title: Remove read notifications?
Post by: badmonkey on June 04, 2017, 12:04:17 am
Could there be a way to batch remove read notifications?  If users don't manually remove them as they're read (and they won't), the database will continue filling with them, needlessly taking space.  Perhaps this should be weekly forum maintenance?
Title: Re: Remove read notifications?
Post by: emanuele on June 04, 2017, 07:21:05 am
A better way to "detect" read notifications would be handy (e.g. mark them as read when the message is read irrespective of how the user reach the message), though nobody managed to make it become reality.
A scheduled task I guess it would work, the "main code" would be something like:
Code: [Select]
$mentions = getAllMentionIDsYouWantToMarkAsRead();
require_once(CONTROLLERDIR . '/Mentions.controller.php');
$mentions = new Mentions_Controller();
foreach ($mentions as $mention_id)
{
$mentions->setData(array(
'id_mention' => $id_mention,
'mark' => 'read',
));
$mentions->action_markread();
}
getAllMentionIDsYouWantToMarkAsRead is of course just a dummy function that require an actual implementation.