Well SUL is set up specifically for WP users and relies completely on WP_User_Query
: https://codex.www.ads-software.com/Class_Reference/WP_User_Query so anything you can do with that you can do with SUL.
I have a filter in SUL called sul_user_query_args
that lets you modify the arguments you are sending to WP_User_Query
. But, for really complex queries (like in your case where you probably need custom SQL to link the tables) you need to get into pre_get_users
.
Here’s a tutorial on pre_get_users
.
https://rudrastyh.com/wordpress/pre_user_query.html
SUL also lets you pass a query_id
so that you can then customize pre_get_users
on a per shortcode basis.
So if you used this shortcode:
[userlist query_id="my_custom_query"]
You could then customize your user query. I *think* you would need to modify the “from” and “where” parts of the query, but I couldn’t tell you the exact SQL you’d need. The above tutorial has some good examples though.
add_action('pre_user_query', 'kia_get_members' );
function kia_get_members( $u_query ) {
if( isset( $u_query->query_id ) && $u_query->query_id == 'my_custom_query' ) {
$u_query->query_from .= 'add some custom SQL here';
$u_query->query_where .= 'add some custom SQL here';
}
}
Good luck! If you figure it all out, please post your results.