當前位置: 首頁>>代碼示例>>PHP>>正文


PHP SendPress_Data::add_subscriber方法代碼示例

本文整理匯總了PHP中SendPress_Data::add_subscriber方法的典型用法代碼示例。如果您正苦於以下問題:PHP SendPress_Data::add_subscriber方法的具體用法?PHP SendPress_Data::add_subscriber怎麽用?PHP SendPress_Data::add_subscriber使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在SendPress_Data的用法示例。


在下文中一共展示了SendPress_Data::add_subscriber方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: create_subscriber

 function create_subscriber()
 {
     $email = $_POST['email'];
     $fname = $_POST['firstname'];
     $lname = $_POST['lastname'];
     $listID = $_POST['listID'];
     $status = $_POST['status'];
     if (is_email($email)) {
         $result = SendPress_Data::add_subscriber(array('firstname' => $fname, 'email' => $email, 'lastname' => $lname));
         SendPress_Data::update_subscriber_status($listID, $result, $status, false);
     }
     SendPress_Admin::redirect('Subscribers_Subscribers', array('listID' => $listID));
 }
開發者ID:radscheit,項目名稱:unicorn,代碼行數:13,代碼來源:class-sendpress-view-subscribers-add.php

示例2: create_subscribers

 function create_subscribers()
 {
     $csvadd = "email,firstname,lastname\n" . trim($_POST['csv-add']);
     $listID = SPNL()->validate->int($_POST['listID']);
     if ($listID > 0) {
         $newsubscribers = SendPress_Data::subscriber_csv_post_to_array($csvadd);
         foreach ($newsubscribers as $subscriberx) {
             if (is_email(trim($subscriberx['email']))) {
                 $result = SendPress_Data::add_subscriber(array('firstname' => trim($subscriberx['firstname']), 'email' => trim($subscriberx['email']), 'lastname' => trim($subscriberx['lastname'])));
                 SendPress_Data::update_subscriber_status($listID, $result, 2, false);
             }
         }
     }
     wp_redirect(esc_url_raw(admin_url('admin.php?page=' . SPNL()->validate->page($_GET['page']) . "&view=subscribers&listID=" . $listID)));
 }
開發者ID:richardsweeney,項目名稱:sendpress,代碼行數:15,代碼來源:class-sendpress-view-subscribers-add.php

示例3: subscribe_user

 static function subscribe_user($listid, $email, $first, $last, $status = 2, $custom = array())
 {
     $success = false;
     $subscriberID = SendPress_Data::add_subscriber(array('firstname' => $first, 'lastname' => $last, 'email' => $email));
     //SendPress_Error::log($subscriberID);
     if (false === $subscriberID) {
         return false;
     }
     $args = array('post_type' => 'sendpress_list', 'numberposts' => -1, 'offset' => 0, 'orderby' => 'post_title', 'order' => 'DESC');
     $lists = get_posts($args);
     $listids = explode(',', $listid);
     $already_subscribed = false;
     if ($status == 2 && SendPress_Option::is_double_optin()) {
         $inlists = SendPress_Data::get_active_list_ids_for_subscriber($subscriberID);
         //SendPress_Error::log($inlists);
         if ($inlists) {
             $already_subscribed = true;
         } else {
             $status = 1;
             SendPress_Manager::send_optin($subscriberID, $listids, $lists);
         }
     }
     foreach ($lists as $list) {
         if (in_array($list->ID, $listids)) {
             $current_status = SendPress_Data::get_subscriber_list_status($list->ID, $subscriberID);
             if (empty($current_status) || isset($current_status->status) && $current_status->status < 2) {
                 $success = SendPress_Data::update_subscriber_status($list->ID, $subscriberID, $status);
             } else {
                 $success = true;
             }
             foreach ($custom as $key => $value) {
                 SendPress_Data::update_subscriber_meta($subscriberID, $key, $value, $list->ID);
             }
         }
     }
     if ($success == false) {
         return false;
     }
     return array('success' => $success, 'already' => $already_subscribed);
 }
開發者ID:pedro-mendonca,項目名稱:sendpress,代碼行數:40,代碼來源:class-sendpress-data.php

示例4: update_post_meta

             $this->add_email_to_queue($go);
             $count++;
         }
     }
     update_post_meta($new_id, '_send_count', $count);
     update_post_meta($new_id, '_send_data', $info);
     $this->log('END ADD QUEUE');
     wp_redirect(esc_url_raw(admin_url('admin.php?page=sp-queue')));
     break;
 case 'create-subscribers':
     $csvadd = "email,firstname,lastname\n" . trim($_POST['csv-add']);
     $listID = $_POST['listID'];
     $newsubscribers = $this->subscriber_csv_post_to_array($csvadd);
     foreach ($newsubscribers as $subscriberx) {
         if (is_email(trim($subscriberx['email']))) {
             $result = SendPress_Data::add_subscriber(array('firstname' => trim($subscriberx['firstname']), 'email' => trim($subscriberx['email']), 'lastname' => trim($subscriberx['lastname'])));
             SendPress_Data::update_subscriber_status($listID, $result, 2, false);
         }
     }
     wp_redirect(esc_url_raw(admin_url('admin.php?page=' . $_GET['page'] . "&view=subscribers&listID=" . $listID)));
     break;
 case 'save-send':
     /*
         $csvadd ="email,firstname,lastname\n" . trim($_POST['test-add']);
         $data=   $this->subscriber_csv_post_to_array($csvadd);
         $listids = isset($_POST['listIDS']) ? $_POST['listIDS'] : array();
     SendPress_Option::set('current_send_'. $_POST['post_ID'], array(
         'listIDS' =>  $listids,
         'testemails'=> $data
         ));
     SendPress_Option::set('current_send_subject_'. $_POST['post_ID'],$_POST['post_subject']);
開發者ID:radscheit,項目名稱:unicorn,代碼行數:31,代碼來源:sendpress-post-actions.php

示例5: addSubscriber

 function addSubscriber($values)
 {
     _deprecated_function(__FUNCTION__, '0.8.9', 'SendPress_Data::add_subscriber()');
     return SendPress_Data::add_subscriber($values);
 }
開發者ID:radscheit,項目名稱:unicorn,代碼行數:5,代碼來源:sendpress.php


注:本文中的SendPress_Data::add_subscriber方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。