2018-03-15, 02:29 PM
Hello, I'm having trouble with MySubscription Plugins, I'm using MyBB 1.8.14 and Subs are not expiring and returning to the previous group. Below is the code for mysubs.php that is in TASK.
Sorry my English
function task_mysubs($task)
{
global $db, $lang;
$lang->load('user_mysubs');
/**
* TODO:
*
* - Check for expired subscriptions.
* - Email subscription updates (optional).
*
*/
$result = $db->simple_select('mysubs_notifs', '*', "`active` = 1 AND `expiration` > 0 AND `expiration` < ".TIME_NOW);
if($result && $db->num_rows($result) > 0)
{
// A subscription expired.
while($sub = $db->fetch_array($result))
{
$db->update_query('users', array('usergroup' => $sub['old_gid']), "`uid` = {$sub['uid']}");
$db->update_query('mysubs_notifs', array('active' => 0));
}
}
add_task_log($task, $lang->task_mysubs_ran);
}
Sorry my English