本文整理汇总了PHP中SendPress_Data::drop_active_subscribers_for_sync方法的典型用法代码示例。如果您正苦于以下问题:PHP SendPress_Data::drop_active_subscribers_for_sync方法的具体用法?PHP SendPress_Data::drop_active_subscribers_for_sync怎么用?PHP SendPress_Data::drop_active_subscribers_for_sync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SendPress_Data
的用法示例。
在下文中一共展示了SendPress_Data::drop_active_subscribers_for_sync方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: html
function html($sp)
{
$list = SPNL()->validate->int($_GET['listID']);
if ($list > 0) {
$role_to_sync = get_post_meta($list, 'sync_role', true);
SendPress_Data::drop_active_subscribers_for_sync($list);
if ($role_to_sync == 'meta') {
$meta_key = get_post_meta($list, 'meta-key', true);
$meta_value = get_post_meta($list, 'meta-value', true);
$meta_compare = get_post_meta($list, 'meta-compare', true);
// WP_User_Query arguments
$args = array('meta_query' => array(array('key' => $meta_key, 'value' => $meta_value, 'compare' => $meta_compare)));
$user_query = new WP_User_Query($args);
$blogusers = $user_query->get_total();
} else {
$result = count_users();
foreach ($result['avail_roles'] as $role => $count) {
if ($role == $role_to_sync) {
$blogusers = $count;
}
}
}
}
//$blogusers = get_users( 'role=' . $role );
//echo count($blogusers);
?>
<div id="taskbar" class="lists-dashboard rounded group">
</div>
<input type="hidden" id="post_ID" name="post_ID" value="<?php
echo $list;
?>
" />
<div class='well' id="sync-wordpress-roles">
<h2><strong><?php
_e('Syncing ', 'sendpress');
?>
<?php
echo ucwords($role);
?>
<?php
_e(' Role to List', 'sendpress');
?>
<?php
echo get_the_title($list);
?>
</strong></h2>
<br>
<div class="progress progress-striped active">
<div class="progress-bar sp-queueit" style="width: 0%;"></div>
</div>
<span id="queue-total">0</span> of <span id="list-total"><?php
echo $blogusers;
?>
</span>
</div>
<?php
}
示例2: html
function html($sp)
{
/*
if(isset($_GET['listID'])){
//$listinfo = $this->getDetail( $this->lists_table(),'listID', $_GET['listID'] );
$listinfo = get_post($_GET['listID']);
$list = '&listID='.$_REQUEST['listID'];
$listname = 'for '. $listinfo->post_title;
}
$role = get_post_meta($_GET['listID'],'sync_role',true);
$blogusers = get_users( 'role=' . $role );
echo count($blogusers);
$email_list = array();
echo "<h2>Sync WordPress users ". $listname."</h2>";
foreach ($blogusers as $user) {
SendPress_Data::update_subscriber_by_email( $user->user_email , array('wp_user_id'=>$user->ID,'firstname'=>$user->first_name,'lastname'=>$user->last_name) );
$email_list[] = $user->user_email;
}
echo "<p>Synced ". count($blogusers) . " users.</p>";
echo "<p>All users not in role <b>".$role."</b> where removed from this list.";
echo "<p>Your list is now up to date</p>";
echo "<a class='btn' href='".SendPress_Admin::link('Subscribers')."'>Back to Lists</a> <a href='".SendPress_Admin::link('Subscribers_Subscribers',array('listID'=>$_GET['listID'])) ."' class='btn'>View Subscribers</a>";
SendPress_Data::sync_emails_to_list( $_GET['listID'] , $email_list );
*/
$role_to_sync = get_post_meta($_GET['listID'], 'sync_role', true);
SendPress_Data::drop_active_subscribers_for_sync($_GET['listID']);
if ($role_to_sync == 'meta') {
$meta_key = get_post_meta($_GET['listID'], 'meta-key', true);
$meta_value = get_post_meta($_GET['listID'], 'meta-value', true);
$meta_compare = get_post_meta($_GET['listID'], 'meta-compare', true);
// WP_User_Query arguments
$args = array('meta_query' => array(array('key' => $meta_key, 'value' => $meta_value, 'compare' => $meta_compare)));
$user_query = new WP_User_Query($args);
$blogusers = $user_query->get_total();
} else {
$result = count_users();
foreach ($result['avail_roles'] as $role => $count) {
if ($role == $role_to_sync) {
$blogusers = $count;
}
}
}
//$blogusers = get_users( 'role=' . $role );
//echo count($blogusers);
?>
<div id="taskbar" class="lists-dashboard rounded group">
</div>
<input type="hidden" id="post_ID" name="post_ID" value="<?php
echo $_GET['listID'];
?>
" />
<div class='well' id="sync-wordpress-roles">
<h2><strong><?php
_e('Syncing ', 'sendpress');
?>
<?php
echo ucwords($role);
?>
<?php
_e(' Role to List', 'sendpress');
?>
<?php
echo get_the_title($_GET['listID']);
?>
</strong></h2>
<br>
<div class="progress progress-striped active">
<div class="progress-bar sp-queueit" style="width: 0%;"></div>
</div>
<span id="queue-total">0</span> of <span id="list-total"><?php
echo $blogusers;
?>
</span>
</div>
<?php
}