WordPress.org

Support

Support » Plugins and Hacks » Groups » [Resolved] [Plugin: Groups] Query API

[Resolved] [Plugin: Groups] Query API

  • Hello and thank you for this plugin. I’m looking for direction on using the API.

    I’m creating a plugin to let users search for other users on the WP front end. I’d like to limit the search query to specific Groups.

    Can I use WP_User_Query to find only users in Groups X? Or does the Groups API offer some other way to accomplish this?

    $args  = array(
    	// search by Group
    	// ??? 'group' => 'X'
    	// Order by
    	'orderby' => 'first_name',
    	// check for two meta_values
    	'meta_query' => array(
    		 array(
    			  // by default compare is '='
    			  'key' => 'active',
    			  'value' => '1',
    		  ),
    		 // add more
    ));
    
    $wp_user_query = new WP_User_Query($args);
    
    // Get the results
    $qresults = $wp_user_query->get_results();

    http://wordpress.org/extend/plugins/groups/

Viewing 1 replies (of 1 total)
  • Plugin Author itthinx

    @itthinx

    $user = new Groups_User( $user_id );
    $groups = $user->__get( 'groups' );

    An example usage can be found in Groups_Shortcodes::groups_user_groups().

Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] [Plugin: Groups] Query API’ is closed to new replies.
Skip to toolbar