本文整理汇总了PHP中RSMembershipHelper::sendExpirationEmails方法的典型用法代码示例。如果您正苦于以下问题:PHP RSMembershipHelper::sendExpirationEmails方法的具体用法?PHP RSMembershipHelper::sendExpirationEmails怎么用?PHP RSMembershipHelper::sendExpirationEmails使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RSMembershipHelper
的用法示例。
在下文中一共展示了RSMembershipHelper::sendExpirationEmails方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onAfterInitialise
function onAfterInitialise()
{
if (class_exists('RSMembershipHelper')) {
$this->loadLanguage('plg_system_rsmembership');
$db = JFactory::getDBO();
$date = JFactory::getDate();
$date = $date->toUnix();
if (RSMembershipHelper::getConfig('last_check') + RSMembershipHelper::getConfig('interval') * 60 > $date) {
return;
}
$db->setQuery("UPDATE #__rsmembership_configuration SET value='" . $date . "' WHERE name='last_check' LIMIT 1");
$db->query();
$offset = RSMembershipHelper::getConfig('delete_pending_after');
if ($offset < 1) {
$offset = 1;
}
$offset = $offset * 3600;
$db->setQuery("DELETE FROM #__rsmembership_transactions WHERE `status`='pending' AND `date` < '" . ($date - $offset) . "'");
$db->query();
// Limit 10 so we don't overload the server
$db->setQuery("SELECT mu.id, m.gid_enable, m.gid_expire, m.disable_expired_account, mu.user_id FROM #__rsmembership_membership_users mu LEFT JOIN #__rsmembership_memberships m ON (mu.membership_id=m.id) WHERE mu.`status`='0' AND mu.`membership_end` > 0 AND mu.`membership_end` < '" . $date . "' LIMIT 10");
$updates = $db->loadObjectList();
$to_update = array();
foreach ($updates as $update) {
$to_update[] = $update->id;
if ($update->gid_enable) {
RSMembership::updateGid($update->user_id, $update->gid_expire);
}
if ($update->disable_expired_account) {
RSMembership::disableUser($update->user_id);
}
}
if (!empty($to_update)) {
$db->setQuery("UPDATE #__rsmembership_membership_users SET `status`='2' WHERE `id` IN (" . implode(',', $to_update) . ")");
$db->query();
}
RSMembershipHelper::checkShared();
RSMembershipHelper::sendExpirationEmails();
}
}