Looper Provider for Users with a custom role type

Hi,
I want to create a slider that features users on our site with the role of “member”. I’m setting up each slide as a Looper consumer and using dynamic content to output the member’s name, profile photo, bio, and a few other ACF fields that I’ve added to the Member role.

However, I’m not sure how to set up the Provider to pull from all users with the role “member”. The Recent Posts and Query Builder options won’t work because users aren’t recognized as post types. Do I need to set up an Array or String? Any help would be appreciated!

Thank you!

Hello @JonesHouseCreative,

Thanks for writing in! That would be possible by creating a custom PHP code that will return the users and use that code for the Looper Provider Custom:

For example if you have something like:

// Return Users  
add_filter( 'cs_looper_custom_return_users', function( $result, $params ) {
  $args = array(
      'role'         => 'member', // Change the user role as per your requirement
  );

  $users = get_users( $args );
  return $users;

}, 10, 2);

The code above serves as an example code. Feel free to modify it when needed. You must maintain any custom coding to ensure it will still work after any updates or does not create any issues or incompatibility in the future.

Be advised that Custom Coding is beyond the scope of our support under our Support Policy. If you are unfamiliar with code and resolving potential conflicts, you may select our One service for further assistance.

Best Regards.

Thank you! That worked perfectly.

You are most welcome @JonesHouseCreative

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.