Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author HelgaTheViking

    (@helgatheviking)

    I think that is pretty counter to default queries so you probably can’t do it with default arguments. You might be able to do it by filtering pre_user_query and writing your own SQL where statements, but I wouldn’t have the slightest idea how.

    Thread Starter GregF

    (@gregf)

    Too bad. Guess I’ll just have to use include for everyone. Luckily, it’s not a huge number. Thanks for the quick response.

    Plugin Author HelgaTheViking

    (@helgatheviking)

    As a sort of hackish way, you could filter the SUL query args, run a user query to get all the IDs of the contributors and then include all those IDs, PLUS your ID.

    I tried the following and I was added to a list of subscribers, but I was added an infinite number of times. As I said, my SQL is pretty crap, but maybe it will give you some ideas.

    add_action( 'pre_user_query', 'kia_user_query' );
    function kia_user_query($query){
    	if( ! is_admin() && isset( $query->query_vars['query_id'] ) && $query->query_vars['query_id'] == 'simple_user_listing' ){
    		global $wpdb;
    		$my_user_id = 1;
    		$query->query_where .= " OR $wpdb->users.ID = $my_user_id";
    	}
    }
    Thread Starter GregF

    (@gregf)

    One more question: Is there any way to control the list order arbitrarily? I have one user (the Director) who needs to come first in the list.

    Plugin Author HelgaTheViking

    (@helgatheviking)

    Not that I know of. Either more complex SQL (SORTBY) or as a workaround you could give every user a specific meta key/value and then order by that.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Role Include’ is closed to new replies.