示例#1
0
 protected static function signup_list_column_content($user_id, Prompt_Interface_Subscribable $list, $edit_url)
 {
     if (!$list->is_subscribed($user_id)) {
         return '';
     }
     $label = $list instanceof Prompt_Site ? __('New Posts', 'Postmatic') : $list->subscription_object_label();
     return html('a', array('href' => $edit_url . '#prompt-site-subscription'), $list->subscription_object_label(), '<br/>');
 }
示例#2
0
 /**
  * Import a MailPoet subscriber.
  *
  * @since 1.0.0
  * @param array $subscriber
  */
 protected function import($subscriber)
 {
     $existing_user = get_user_by('email', $subscriber['email']);
     if ($existing_user and $this->target_list->is_subscribed($existing_user->ID)) {
         $this->already_subscribed_count++;
         return;
     }
     if (!$existing_user) {
         $subscriber_id = Prompt_User_Handling::create_from_email($subscriber['email']);
         wp_update_user(array('ID' => $subscriber_id, 'first_name' => $subscriber['firstname'], 'last_name' => $subscriber['lastname']));
     } else {
         $subscriber_id = $existing_user->ID;
     }
     $this->target_list->subscribe($subscriber_id);
     $prompt_user = new Prompt_User($subscriber_id);
     $origin = new Prompt_Subscriber_Origin(array('source_label' => 'Mailpoet Import', 'source_url' => scbUtil::get_current_url()));
     $prompt_user->set_subscriber_origin($origin);
     $this->imported_count++;
 }
示例#3
0
 /**
  * @param Prompt_Interface_Subscribable $object
  * @param WP_User $subscriber
  * @param boolean $found_by_email
  * @return string Step response message
  */
 protected static function unsubscribe($object, $subscriber, $found_by_email)
 {
     $object->unsubscribe($subscriber->ID);
     Prompt_Subscription_Mailing::send_unsubscription_notification($subscriber->ID, $object);
     return __('You have unsubscribed.', 'Postmatic');
 }