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


PHP WP_User_Query::get_results方法代码示例

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


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

示例1: kbs_get_users_by_role

/**
 * Retrieve users by role.
 *
 * @since	1.0
 * @param	str	$role	Name of the role to retrieve.
 * @return	mixed
 */
function kbs_get_users_by_role($role = array('support_agent', 'support_manager'))
{
    global $wpdb;
    $user_query = new WP_User_Query(array('orderby' => 'display_name', 'role__in' => $role));
    $users = $user_query->get_results();
    return $users;
}
开发者ID:KB-Support,项目名称:kb-support,代码行数:14,代码来源:user-functions.php

示例2: array

 function get_clients()
 {
     $users = array();
     $roles = array('administrator', 'author', 'editor', 'contributor');
     foreach ($roles as $role) {
         $users_query = new WP_User_Query(array('fields' => 'all_with_meta', 'role' => $role, 'orderby' => 'display_name'));
         $results = $users_query->get_results();
         if ($results) {
             $users = array_merge($users, $results);
         }
     }
     return $users;
 }
开发者ID:m-godefroid76,项目名称:devrestofactory,代码行数:13,代码来源:ourteam_widget.php

示例3: upgrade_store_meta_23

/**
 * Upgrade store meta for sellers
 * and replace old address meta with new address meta
 *
 * @since 2.3
 *
 * @return void
 */
function upgrade_store_meta_23()
{
    $query = new WP_User_Query(array('role' => 'seller'));
    $sellers = $query->get_results();
    $default_settings = array('store_name' => '', 'location' => '', 'find_address' => '', 'banner' => '', 'phone' => '', 'show_email' => '', 'gravatar' => '', 'payment' => array(), 'social' => array());
    foreach ($sellers as $seller) {
        $current_settings = dokan_get_store_info($seller->ID);
        $current_settings = wp_parse_args($current_settings, $default_settings);
        $old_address = $current_settings['address'];
        $new_address = array('street_1' => $old_address, 'street_2' => '', 'city' => '', 'zip' => '', 'country' => '', 'state' => '');
        $current_settings['address'] = $new_address;
        update_user_meta($seller->ID, 'dokan_profile_settings', $current_settings);
    }
}
开发者ID:StefanBonilla,项目名称:CoupSoup,代码行数:22,代码来源:dokan-upgrade-2.3.php

示例4: get_ex_members

function get_ex_members()
{
    $ex_synergia_member_args = array('role' => 'ex_synergia_member');
    $ex_synergia_member_query = new WP_User_Query($ex_synergia_member_args);
    $ex_synergia_members = $ex_synergia_member_query->get_results();
    return $ex_synergia_members;
}
开发者ID:synergia,项目名称:mknm-synergia-theme,代码行数:7,代码来源:utils.php

示例5: memberful_private_user_feed_init

function memberful_private_user_feed_init()
{
    // In case this is not available, just don't carry on with the logic, it should always be here.
    if (!isset($_SERVER['REQUEST_URI'])) {
        return;
    }
    // This is not a case we can verify, so we'll skip
    if (strpos($_SERVER['REQUEST_URI'], memberful_private_user_feed_get_url_identifier()) === false) {
        return;
    }
    // Extract the token from the URL
    $feedUserToken = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], memberful_private_user_feed_get_url_identifier()) + strlen(memberful_private_user_feed_get_url_identifier()));
    $requiredPlan = memberful_private_user_feed_settings_get_required_plan();
    // We want to allow the private user feed only if the admin has configured it.
    if ($requiredPlan == false) {
        return;
    }
    // The only reliable way to make sure it works on all WP versions
    // We'll take "all" users with the token match.
    $user_query = new WP_User_Query(array('meta_key' => 'memberful_private_user_feed_token', 'meta_value' => $feedUserToken));
    // Get the results from the query
    $users = $user_query->get_results();
    // We have no results.
    if (empty($users)) {
        return;
    }
    // In case somebody actually maps this with their plugin with a hook, we still need to get the first one.
    $user = array_shift($users);
    if (!is_subscribed_to_memberful_plan($requiredPlan, $user->ID)) {
        return;
    }
    // Everything is in order, we'll deliver the feed.
    memberful_private_user_feed_deliver();
}
开发者ID:andrewkhunn,项目名称:lancero,代码行数:34,代码来源:private_user_feed.php

示例6: delete

 /**
  * Delete User Role and all User's in role if requested
  * 
  * @param boolean $delete_users
  * 
  * @return boolean
  * 
  * @access public
  */
 public function delete($delete_users = false)
 {
     $role = new WP_Roles();
     if ($this->getId() !== 'administrator') {
         if ($delete_users) {
             if (current_user_can('delete_users')) {
                 //delete users first
                 $users = new WP_User_Query(array('number' => '', 'blog_id' => get_current_blog_id(), 'role' => $this->getId()));
                 foreach ($users->get_results() as $user) {
                     //user can not delete himself
                     if ($user instanceof WP_User && $user->ID != get_current_user_id()) {
                         wp_delete_user($user->ID);
                     }
                 }
                 $role->remove_role($this->getId());
                 $status = true;
             } else {
                 $status = false;
             }
         } else {
             $role->remove_role($this->getId());
             $status = true;
         }
     } else {
         $status = false;
     }
     return $status;
 }
开发者ID:subhadip-sahoo,项目名称:wp-project1,代码行数:37,代码来源:role.php

示例7: render

 /**
  * Rendering the shortcode this class is responsible for.
  *
  * @return string $content
  */
 public function render()
 {
     $all_users = $this->user_query->get_results();
     // if the user has specified more users add them as well.
     if (!empty($this->include)) {
         $included_users_query = new WP_User_Query(array('include' => $this->include));
         $included_users = $included_users_query->get_results();
         if (!empty($included_users)) {
             $merged_users = array_merge($all_users, $included_users);
             $all_users = $this->users_unique($merged_users);
             $all_users = $this->users_sort($all_users);
         }
     }
     // exclude the users not wanted
     if (!empty($this->exclude)) {
         $all_users = $this->exclude_users($all_users, $this->exclude);
     }
     if (!count($all_users) > 0) {
         return '';
     }
     $users_output = '';
     foreach ($all_users as $user) {
         $user_display_name = $this->get_user_public_name($user);
         /**
          * Sensei teachers shortcode list item filter
          *
          * @since 1.9.0
          *
          * @param string $teacher_li the html for the teacher li
          * @param WP_User $user
          */
         $users_output .= apply_filters('sensei_teachers_shortcode_list_item', '<li class="teacher"><a href="' . get_author_posts_url($user->ID) . '">' . $user_display_name . '<a/></li>', $user);
     }
     return '<ul class="sensei-teachers">' . $users_output . '</ul>';
 }
开发者ID:pra85,项目名称:sensei,代码行数:40,代码来源:class-sensei-shortcode-teachers.php

示例8: isset

 function prepare_items()
 {
     global $role, $usersearch;
     $usersearch = isset($_REQUEST['s']) ? trim($_REQUEST['s']) : '';
     $role = isset($_REQUEST['role']) ? $_REQUEST['role'] : '';
     $per_page = $this->is_site_users ? 'site_users_network_per_page' : 'users_per_page';
     $users_per_page = $this->get_items_per_page($per_page);
     $paged = $this->get_pagenum();
     $args = array('number' => $users_per_page, 'offset' => ($paged - 1) * $users_per_page, 'role' => $role, 'search' => $usersearch, 'fields' => 'all_with_meta');
     if ('' !== $args['search']) {
         $args['search'] = '*' . $args['search'] . '*';
     }
     if ($this->is_site_users) {
         $args['blog_id'] = $this->site_id;
     }
     if (isset($_REQUEST['orderby'])) {
         $args['orderby'] = $_REQUEST['orderby'];
     }
     if (isset($_REQUEST['order'])) {
         $args['order'] = $_REQUEST['order'];
     }
     // Query the user IDs for this page
     $wp_user_search = new WP_User_Query($args);
     $this->items = $wp_user_search->get_results();
     $this->set_pagination_args(array('total_items' => $wp_user_search->get_total(), 'per_page' => $users_per_page));
 }
开发者ID:rkglug,项目名称:WordPress,代码行数:26,代码来源:class-wp-users-list-table.php

示例9: pd_cd_get_customer_users

/**
 * Get the customer list.
 *
 * Taken from WooCommerce code at:
 * includes/admin/reports/class-wc-report-customer-list.php:WC_Report_Customer_List->prepare_items()
 *
 * @since 0.1.0
 *
 * @return array User list
 */
function pd_cd_get_customer_users()
{
    $admin_users = new WP_User_Query(array('role' => 'administrator1', 'fields' => 'ID'));
    $manager_users = new WP_User_Query(array('role' => 'shop_manager', 'fields' => 'ID'));
    $query = new WP_User_Query(array('exclude' => array_merge($admin_users->get_results(), $manager_users->get_results())));
    $customers = $query->get_results();
    return $customers;
}
开发者ID:realbig,项目名称:PL_PEACEFULDRAGON_CUSTOMERDATA,代码行数:18,代码来源:pd-customerdata-functions.php

示例10: formatResults

 /**
  * 
  * @param \WP_User_Query $uQuery
  * @return multitype:number multitype:multitype:string Ambigous <false, string>
  */
 public function formatResults(\WP_User_Query $uQuery)
 {
     $userArray = array();
     foreach ($uQuery->get_results() as $user) {
         $userArray[] = $this->formatUserAsArray($user);
     }
     return array("page" => $this->getPage($uQuery->get("number"), $uQuery->get("offset")), "pages" => $this->getNumberOfPages($uQuery->total_users, $uQuery->get("number")), "limit" => $uQuery->get("number"), "total" => $uQuery->total_users, "users" => $userArray);
 }
开发者ID:javierdlahoz,项目名称:dcbia-wp,代码行数:13,代码来源:MemberFacade.php

示例11: get_user_by_meta_data

 protected function get_user_by_meta_data($meta_key, $meta_value)
 {
     // Query for users based on the meta data
     $user_query = new WP_User_Query(array('meta_key' => $meta_key, 'meta_value' => $meta_value));
     // Get the results from the query, returning the first user
     $users = $user_query->get_results();
     return isset($users[0]) ? $users[0] : 0;
 }
开发者ID:httvncoder,项目名称:151722441,代码行数:8,代码来源:class-dln-json-fbusers.php

示例12: um_clean_user_basename_filter

function um_clean_user_basename_filter($value, $raw)
{
    global $wpdb;
    $permalink_base = um_get_option('permalink_base');
    $user_query = new WP_User_Query(array('meta_query' => array('relation' => 'AND', array('key' => 'um_user_profile_url_slug_name_' . $raw), array('key' => 'account_status', 'value' => 'awaiting_admin_review', 'compare' => '!='))));
    $result = current($user_query->get_results());
    $slugname = '';
    if (isset($result->data->ID)) {
        $slugname = get_user_meta($result->data->ID, 'um_user_profile_url_slug_name_' . $raw, true);
        $value = $slugname;
    }
    $value = apply_filters("um_permalink_base_before_filter", $value);
    $raw_value = $value;
    switch ($permalink_base) {
        case 'name':
            if (!empty($value) && strrpos($value, "_") > -1) {
                $value = str_replace('_', '. ', $value);
            }
            if (!empty($value) && strrpos($value, "_") > -1) {
                $value = str_replace('_', '-', $value);
            }
            if (!empty($value) && strrpos($value, ".") > -1 && strrpos($raw_value, "_") <= -1) {
                $value = str_replace('.', ' ', $value);
            }
            $value = apply_filters("um_permalink_base_after_filter_name", $value, $raw_value);
            break;
        case 'name_dash':
            if (!empty($value) && strrpos($value, "-") > -1) {
                $value = str_replace('-', ' ', $value);
            }
            if (!empty($value) && strrpos($value, "_") > -1) {
                $value = str_replace('_', '-', $value);
            }
            // Checks if last name has a dash
            if (!empty($value) && strrpos($value, "_") > -1) {
                $value = str_replace('_', '-', $value);
            }
            $value = apply_filters("um_permalink_base_after_filter_name_dash", $value, $raw_value);
            break;
        case 'name_plus':
            if (!empty($value) && strrpos($value, "+") > -1) {
                $value = str_replace('+', ' ', $value);
            }
            if (!empty($value) && strrpos($value, "_") > -1) {
                $value = str_replace('_', '+', $value);
            }
            $value = apply_filters("um_permalink_base_after_filter_name_plus", $value, $raw_value);
            break;
        default:
            // Checks if last name has a dash
            if (!empty($value) && strrpos($value, "_") > -1 && substr($value, "_") == 1) {
                $value = str_replace('_', '-', $value);
            }
            $value = apply_filters("um_permalink_base_after_filter", $value, $raw_value);
            break;
    }
    return $value;
}
开发者ID:TeamSubjectMatter,项目名称:juddfoundation,代码行数:58,代码来源:um-filters-user.php

示例13: prepare_items

	/**
	 *
	 * @global string $usersearch
	 * @global string $role
	 * @global wpdb   $wpdb
	 * @global string $mode
	 */
	public function prepare_items() {
		global $usersearch, $role, $wpdb, $mode;

		$usersearch = isset( $_REQUEST['s'] ) ? wp_unslash( trim( $_REQUEST['s'] ) ) : '';

		$users_per_page = $this->get_items_per_page( 'users_network_per_page' );

		$role = isset( $_REQUEST['role'] ) ? $_REQUEST['role'] : '';

		$paged = $this->get_pagenum();

		$args = array(
			'number' => $users_per_page,
			'offset' => ( $paged-1 ) * $users_per_page,
			'search' => $usersearch,
			'blog_id' => 0,
			'fields' => 'all_with_meta'
		);

		if ( wp_is_large_network( 'users' ) )
			$args['search'] = ltrim( $args['search'], '*' );

		if ( $role == 'super' ) {
			$logins = implode( "', '", get_super_admins() );
			$args['include'] = $wpdb->get_col( "SELECT ID FROM $wpdb->users WHERE user_login IN ('$logins')" );
		}

		/*
		 * If the network is large and a search is not being performed,
		 * show only the latest users with no paging in order to avoid
		 * expensive count queries.
		 */
		if ( !$usersearch && wp_is_large_network( 'users' ) ) {
			if ( !isset($_REQUEST['orderby']) )
				$_GET['orderby'] = $_REQUEST['orderby'] = 'id';
			if ( !isset($_REQUEST['order']) )
				$_GET['order'] = $_REQUEST['order'] = 'DESC';
			$args['count_total'] = false;
		}

		if ( isset( $_REQUEST['orderby'] ) )
			$args['orderby'] = $_REQUEST['orderby'];

		if ( isset( $_REQUEST['order'] ) )
			$args['order'] = $_REQUEST['order'];

		$mode = empty( $_REQUEST['mode'] ) ? 'list' : $_REQUEST['mode'];

		// Query the user IDs for this page
		$wp_user_search = new WP_User_Query( $args );

		$this->items = $wp_user_search->get_results();

		$this->set_pagination_args( array(
			'total_items' => $wp_user_search->get_total(),
			'per_page' => $users_per_page,
		) );
	}
开发者ID:ShankarVellal,项目名称:WordPress,代码行数:65,代码来源:class-wp-ms-users-list-table.php

示例14: getUsers

 private function getUsers()
 {
     $adminUsers = new \WP_User_Query(array('role' => 'administrator', 'fields' => 'ID'));
     $managerUsers = new \WP_User_Query(array('role' => 'shop_manager', 'fields' => 'ID'));
     $query = new \WP_User_Query(array('exclude' => array_merge($adminUsers->get_results(), $managerUsers->get_results()), 'number' => $this->csvExportStart ? 0 : 20, 'offset' => $this->csvExportStart ? 0 : ($this->getCurrentPage() - 1) * 20, 'search' => '*' . $this->getSearch() . '*'));
     $this->totalItems = $query->get_total();
     $this->totalPages = ceil($query->get_total() / 20);
     return $query->get_results();
 }
开发者ID:jigoshop,项目名称:Jigoshop2,代码行数:9,代码来源:CustomerList.php

示例15: fetch

 public static function fetch($args = array())
 {
     $users = array();
     $q_user = new \WP_User_Query($args);
     foreach ($q_user->get_results() as $user) {
         $users[$user->ID] = new static($user);
     }
     return $users;
 }
开发者ID:daidais,项目名称:morepress,代码行数:9,代码来源:User.php


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