• Resolved rajmataj

    (@rajmataj)


    Is there a way to show multiple roles at once using one line of shortcode? I know I can create two lines but then I get the search box and the listings are in mixed alphabetical order (one list in alpha, followed by another list in alpha)

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

    (@helgatheviking)

    I believe you can just separate the roles with a comma.

    [userlist role="outfield,infield"]

    But per the docs on WP_User_Query the only users shown will be users that match both the provided roles. In reading the docs it looks like WP_User_Query supports role__in and role__not_in which I will try to add support for eventually.

    Thread Starter rajmataj

    (@rajmataj)

    Thanks for your quick reply. You’re right about the user needing both roles. The trouble is, I have two sets of users with different and exclusive roles. Is there a way to turn off the search capability for now?

    Plugin Author HelgaTheViking

    (@helgatheviking)

    I’d say it’s in the FAQ, because it is, but I’ve just realized that it’s wrong.

    This is what it will be after the next update:

    function remove_SUL_search(){
        remove_action( 'simple_user_listing_before_loop', array( Simple_User_Listing::get_instance(), 'add_search' ) );
    }
    add_action( 'simple_user_listing_before_loop', 'remove_SUL_search', 5 );

    If you need it right now, then this should do it:

    function remove_SUL_search(){
    	global $simple_user_listing;
        remove_action( 'simple_user_listing_before_loop', array( $simple_user_listing, 'add_search' ) );
    }
    add_action( 'simple_user_listing_before_loop', 'remove_SUL_search', 5 );
    Thread Starter rajmataj

    (@rajmataj)

    Thanks. I’m not a WordPress developer, so I’m uncertain where this code would go. Would I put it into a custom template copied from SUL? Any idea when the next release would come out?

    Plugin Author HelgaTheViking

    (@helgatheviking)

    It would go in your theme’s functions.php file. No promised on the next release. I am hoping for next week, but all my paid plugins and clients take priority over this plugin so while it is on my to-do list it is at the very bottom. The new version will be back-compatible with the second snippet so that one is pretty safe for now and the immediate future.

    Thread Starter rajmataj

    (@rajmataj)

    Thanks for the info and quick reply.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to show multiple roles’ is closed to new replies.