SHOW:
|
|
- or go back to the newest paste.
| 1 | function check_expirations($field = null, $value = null, $single = false, $subsriber_id = false) {
| |
| 2 | global $wpdb, $Db, $SubscribersList, $Subscriber, $Mailinglist; | |
| 3 | $conditions = array('paid' => "Y");
| |
| 4 | ||
| 5 | if (!empty($single) && $single == true && !empty($subscriber_id)) {
| |
| 6 | $conditions['subscriber_id'] = $subscriber_id; | |
| 7 | } | |
| 8 | ||
| 9 | $subscriberslists = $SubscribersList -> find_all(array('paid' => "Y"));
| |
| 10 | ||
| 11 | if (!empty($subscriberslists)) {
| |
| 12 | foreach ($subscriberslists as $sl) {
| |
| 13 | - | if ($sl -> paid == "Y" && $sl -> ppsubscription != "Y") {
|
| 13 | + | if ($sl -> paid == "Y" && $sl -> active == "Y" && $sl -> ppsubscription != "Y") {
|
| 14 | $mailinglist = $Mailinglist -> get($sl -> list_id, false); | |
| 15 | $expiry = $Mailinglist -> gen_expiration_date($sl -> subscriber_id, $sl -> list_id); | |
| 16 | ||
| 17 | if ($mailinglist -> interval != "once" && time() >= strtotime($expiry)) {
| |
| 18 | $conditions = array('subscriber_id' => $sl -> subscriber_id, 'list_id' => $sl -> list_id);
| |
| 19 | $this -> save_field('paid', "N", $conditions);
| |
| 20 | $this -> save_field('active', "N", $conditions);
| |
| 21 | ||
| 22 | $mailinglist = $Mailinglist -> get($sl -> list_id, false); | |
| 23 | if ($mailinglist -> paid == "Y") {
| |
| 24 | $subscriber = $Subscriber -> get($sl -> subscriber_id, false); | |
| 25 | $subscriber -> mailinglist_id = $sl -> list_id; | |
| 26 | $subject = $this -> et_subject('expire');
| |
| 27 | $fullbody = $this -> et_message('expire');
| |
| 28 | $message = $this -> render_email(false, array('subscriber' => $subscriber, 'mailinglist' => $mailinglist), false, $this -> htmltf($subscriber -> format), true, $this -> default_theme_id(), false, $fullbody);
| |
| 29 | $this -> execute_mail($subscriber, $subject, $message, false, false, false, false); | |
| 30 | } | |
| 31 | } | |
| 32 | } | |
| 33 | } | |
| 34 | ||
| 35 | return true; | |
| 36 | } | |
| 37 | ||
| 38 | return false; | |
| 39 | } |