当前位置: 首页>>代码示例>>PHP>>正文


PHP SendPress_Data::update_subscriber_meta方法代码示例

本文整理汇总了PHP中SendPress_Data::update_subscriber_meta方法的典型用法代码示例。如果您正苦于以下问题:PHP SendPress_Data::update_subscriber_meta方法的具体用法?PHP SendPress_Data::update_subscriber_meta怎么用?PHP SendPress_Data::update_subscriber_meta使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SendPress_Data的用法示例。


在下文中一共展示了SendPress_Data::update_subscriber_meta方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: save

 function save()
 {
     if (isset($_POST['delete-this-user']) && $_POST['delete-this-user'] == 'yes') {
         SendPress_Data::delete_subscriber($_POST['subscriberID']);
         if ($_GET['listID']) {
             SendPress_Admin::redirect('Subscribers_Subscribers', array('listID' => $_GET['listID']));
         } else {
             SendPress_Admin::redirect('Subscribers_All');
         }
     } else {
         global $post;
         $subscriber_info = array('email' => $_POST['email'], 'firstname' => $_POST['firstname'], 'lastname' => $_POST['lastname']);
         SendPress_Data::update_subscriber($_POST['subscriberID'], $subscriber_info);
         $args = array('post_type' => 'sendpress_list', 'post_status' => array('publish', 'draft'), 'posts_per_page' => 100, 'order' => 'ASC', 'orderby' => 'title');
         $postslist = get_posts($args);
         foreach ($postslist as $post) {
             setup_postdata($post);
             if (isset($_POST[$post->ID . "-status"]) && $_POST[$post->ID . "-status"] > 0) {
                 SendPress_Data::update_subscriber_status($post->ID, $_POST['subscriberID'], $_POST[$post->ID . "-status"]);
             } else {
                 SendPress_Data::remove_subscriber_status($post->ID, $_POST['subscriberID']);
             }
             $notifications = SendPress_Data::get_post_notification_types();
             if (isset($_POST[$post->ID . "-pn"]) && array_key_exists($_POST[$post->ID . "-pn"], $notifications)) {
                 SendPress_Data::update_subscriber_meta($_POST['subscriberID'], 'post_notifications', $_POST[$post->ID . "-pn"], $post->ID);
             }
         }
         wp_reset_postdata();
     }
     SendPress_Admin::redirect('Subscribers_Subscriber', array('subscriberID' => $_POST['subscriberID']));
 }
开发者ID:pmatheus,项目名称:participacao-sitebase,代码行数:31,代码来源:class-sendpress-view-subscribers-subscriber.php

示例2: 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


注:本文中的SendPress_Data::update_subscriber_meta方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。