/** * Verify that we have MailPoet subscribers. * * If they haven't been retrieved yet, retrieve them. * * @since 1.0.0 */ protected function ensure_subscribers() { if (isset($this->subscribers)) { return; } $this->subscribers = array(); // Enable the model to return more than 10 records. Could be fragile. $this->user_model->limit_pp = 1000000; $list_subscribers = $this->user_model->get_subscribers(array('A.email', 'A.firstname', 'A.lastname', 'A.last_opened', 'A.last_clicked', 'A.created_at'), array('lists' => $this->mailpoet_list_ids)); foreach ($list_subscribers as $list_subscriber) { $this->add_source_subscriber($list_subscriber); } }
/** * triggered before a user is deleted using the delete function of the user model * @return boolean */ function beforeDelete($conditions) { $model_user = new WYSIJA_model_user(); $users = $model_user->get(array('user_id'), $this->conditions); $user_ids = array(); foreach ($users as $user) { $user_ids[] = $user['user_id']; } //delete all the user stats $model_email_user_stat = WYSIJA::get('email_user_stat', 'model'); $conditions = array('user_id' => $user_ids); $model_email_user_stat->delete($conditions); //delete all the queued emails $model_queue = WYSIJA::get('queue', 'model'); $model_queue->delete($conditions); return true; }
function beforeDelete() { $newum = new WYSIJA_model_user(); $users = $newum->get(array('user_id'), $this->conditions); $userids = array(); foreach ($users as $usr) { $userids[] = $usr['user_id']; } //delete all the user stats $eusM =& WYSIJA::get('email_user_stat', 'model'); $conditions = array('user_id' => $userids); $eusM->delete($conditions); //delete all the queued emails $qM =& WYSIJA::get('queue', 'model'); $qM->delete($conditions); return true; }