Hello Beda
Thanks for the reply, it is the first time that we have come into contact with each other.
I have read some interesting tips from you, nice to meet you!
I've tried but I can't get the job done. I think I understand the explanation not well, I find it very difficult.
What I have done in the meantime:
I changed the sorting function in the toolset settings to Provincie (=region see image) (wpcf-provincie-bedrijf)
in this way the users are displayed by region in alphabetical order.
Only the subscribers are shown and that is the intention.
What needs to be done is that the company names of these subscribers are also in alphabetical order (wpcf-bedrijfsnaam)
The users (subscribers) must be shown by region (wpcf-provincie-bedrijf) in alphabetical order and company name (wpcf-bedrijfsnaam) in alphabetical order. There must be no limit for showing users (subsribers)
I used your sample code to create the sort function, I played with the code and added the code to functions.php and looked at the result. The results: 1) no changes to be seen, 2) the changes are seen but now all users are shown, not only subscribers.
Through the url https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_user_query I saw that a fiter can be set, do I have to add these separately to the code you gave me? (see below).
Can you indicate to me how this should be completed?
//If you have a filter in the View to include users from different roles and do not want the role set in the Content selection section to be applied, you can do something like this
add_filter( 'wpv_filter_user_query', 'prefix_unset_user_roles' );
function prefix_unset_user_roles( $query_args ) {
if ( isset( $query_args['role'] ) ) {
unset( $query_args['role'] );
}
return $query_args;
}
As for the example code below, what exactly must be entered at wpcf_test_user?
I entered there in the code wpcf-provincie-bedrijf, at wpcf_another_field I added wpcf-bedrijfsnaam
add_filter( 'wpv_filter_user_query', 'prefix_unset_user_roles', 99 );
function prefix_unset_user_roles( $query_args ) {
$query_args = array(
'orderby' => array(
'wpcf_test_user' => 'DESC',
'wpcf_another_field' => 'DESC',
),
'meta_query' => array(
'relation' => 'AND',
'wpcf_test_user' => array(
'key' => 'wpcf-test-user',
),
'wpcf_another_field' => array(
'key' => 'wpcf-another-field',
)
)
);
//var_dump($query_args['orderby']);
return $query_args;
}
I have tried various combinations, but can't really get it done.
Would you still help me with this?
Thanks in advance and enjoy the weekend!
Greetings Pascal