Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function check_expirations($field = null, $value = null, $single = false, $subsriber_id = false) {
- global $wpdb, $Db, $SubscribersList, $Subscriber, $Mailinglist;
- $conditions = array('paid' => "Y");
- if (!empty($single) && $single == true && !empty($subscriber_id)) {
- $conditions['subscriber_id'] = $subscriber_id;
- }
- $subscriberslists = $SubscribersList -> find_all(array('paid' => "Y"));
- if (!empty($subscriberslists)) {
- foreach ($subscriberslists as $sl) {
- if ($sl -> paid == "Y" && $sl -> ppsubscription != "Y") {
- $mailinglist = $Mailinglist -> get($sl -> list_id, false);
- $expiry = $Mailinglist -> gen_expiration_date($sl -> subscriber_id, $sl -> list_id);
- if ($mailinglist -> interval != "once" && time() >= strtotime($expiry)) {
- $conditions = array('subscriber_id' => $sl -> subscriber_id, 'list_id' => $sl -> list_id);
- $this -> save_field('paid', "N", $conditions);
- $this -> save_field('active', "N", $conditions);
- $mailinglist = $Mailinglist -> get($sl -> list_id, false);
- if ($mailinglist -> paid == "Y") {
- $subscriber = $Subscriber -> get($sl -> subscriber_id, false);
- $subscriber -> mailinglist_id = $sl -> list_id;
- $subject = $this -> et_subject('expire');
- $fullbody = $this -> et_message('expire');
- $message = $this -> render_email(false, array('subscriber' => $subscriber, 'mailinglist' => $mailinglist), false, $this -> htmltf($subscriber -> format), true, $this -> default_theme_id(), false, $fullbody);
- $this -> execute_mail($subscriber, $subject, $message, false, false, false, false);
- }
- }
- }
- }
- return true;
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment