本文整理汇总了PHP中ap_has_users函数的典型用法代码示例。如果您正苦于以下问题:PHP ap_has_users函数的具体用法?PHP ap_has_users怎么用?PHP ap_has_users使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ap_has_users函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: widget
public function widget($args, $instance)
{
global $ap_user_query;
$title = apply_filters('widget_title', $instance['title']);
$number = $instance['number'];
$sortby = $instance['sortby'];
echo $args['before_widget'];
if (!empty($title)) {
echo $args['before_title'] . $title . $args['after_title'];
}
$user_a = array('number' => $number, 'sortby' => $sortby);
// The Query.
$ap_user_query = ap_has_users($user_a);
echo '<div class="ap-widget-inner">';
while (ap_users()) {
ap_the_user();
include ap_get_theme_location('users/loop-item.php');
}
echo '</div>';
echo $args['after_widget'];
}
示例2: widget
public function widget($args, $instance)
{
$title = apply_filters('widget_title', $instance['title']);
$number = $instance['number'];
$avatar_size = $instance['avatar_size'];
echo $args['before_widget'];
if (!empty($title)) {
echo $args['before_title'] . $title . $args['after_title'];
}
if (is_ap_user()) {
$followers = ap_has_users(array('user_id' => ap_get_displayed_user_id(), 'sortby' => 'followers'));
if ($followers->has_users()) {
include ap_get_theme_location('widgets/followers.php');
} else {
_e('No followers yet', 'ap');
}
} else {
_e('This widget can only be used in user page.', 'ap');
}
echo $args['after_widget'];
}
示例3: widget
public function widget($args, $instance)
{
$title = apply_filters('widget_title', $instance['title']);
echo $args['before_widget'];
if (!empty($title)) {
echo $args['before_title'] . $title . $args['after_title'];
}
global $ap_user_query;
if (is_user_logged_in()) {
$ap_user_query = ap_has_users(array('ID' => ap_get_displayed_user_id()));
if ($ap_user_query->has_users()) {
while (ap_users()) {
ap_the_user();
ap_get_template_part('widgets/user');
}
}
} else {
_e('Login to see your profile links', 'ap');
}
echo $args['after_widget'];
}
示例4: following_page
/**
* Register followers page in AnsPress
*/
public function following_page()
{
$following = ap_has_users(array('user_id' => ap_get_displayed_user_id(), 'sortby' => 'following'));
if ($following->has_users()) {
include ap_get_theme_location('user/following.php');
} else {
esc_attr_e('You are not following anyone.', 'anspress-question-answer');
}
}
示例5: ap_user_card
/**
* Handle Ajax callback for user hover card
*/
public function ap_user_card()
{
if (ap_opt('disable_hover_card')) {
$this->something_wrong();
}
$user_id = (int) $_POST['user_id'];
if (!ap_verify_default_nonce()) {
$this->something_wrong();
}
global $ap_user_query;
$ap_user_query = ap_has_users(array('ID' => $user_id));
if ($ap_user_query->has_users()) {
while (ap_users()) {
ap_the_user();
ap_get_template_part('user/user-card');
}
}
wp_die();
}
示例6: search_page
/**
* Load search page template
*/
public function search_page()
{
global $questions;
$keywords = sanitize_text_field(get_query_var('ap_s'));
$type = sanitize_text_field(wp_unslash(@$_GET['type']));
if ('' == $type) {
$questions = ap_get_questions(array('s' => $keywords));
include ap_get_theme_location('base.php');
} elseif ('user' == $type && ap_opt('enable_users_directory')) {
global $ap_user_query;
$ap_user_query = ap_has_users(array('search' => $keywords, 'search_columns' => array('user_login', 'user_email', 'user_nicename')));
include ap_get_theme_location('users/users.php');
}
}
示例7: ap_user_cover
public function ap_user_cover()
{
if (ap_opt('disable_hover_card')) {
ap_send_json(ap_ajax_responce('something_wrong'));
}
$user_id = (int) $_POST['user_id'];
if (!wp_verify_nonce($_POST['ap_ajax_nonce'], 'ap_ajax_nonce')) {
ap_send_json(ap_ajax_responce('something_wrong'));
return;
}
global $ap_user_query;
$ap_user_query = ap_has_users(array('ID' => $user_id));
if ($ap_user_query->has_users()) {
while (ap_users()) {
ap_the_user();
ap_get_template_part('user/user-card');
}
} else {
ap_send_json(ap_ajax_responce('something_wrong'));
}
die;
}