Tell us what you are trying to do?
Its' simple: I have custom fields in a user form. User register via the frontend to my site. Just like the example with the gym trainers in your documentation, I just need to list some users according to a taxonomy like "Executive Board".
I need a page that lists all executive board members on my association. How can I achieve this? I have created the role "Executive Members".
Is there any documentation that you are following?
I can't see nay straightforward documentation on how to lop through users. The other solution will be to
Is there a similar example that we can see?
You would use a View for this, but the View block doesn't support querying users.
You need to use the legacy View editor for this.
First, go to Toolset > Settings and under "Editing experience" choose to show both the legacy and blocks UI.
Then under the Toolset menu you will see added a Views menu item. Click on it and you'll see a list of existing Views (those created with the block editor so far), and if you add a new View it will open in the legacy editor.
In the Content Selection you can switch to query users and specify the role of users that should be displayed.
The loop output section is where you specify what to include in the output. This is a markup editor, where you can add HTML, and the dynamic content (e.g. the user's name) is produced by shortcodes. Use the Fields and Views button to generate the necessary shortcodes.
Normally you would run the Loop Wizard to specify how the results are output (e.g. in a grid, or in an unformatted list), and it is usually helpful to check the option to use a content template to design the output.
Try that and see how you get on, and let us know if you need more help.
I used cred_save_data in the functions.php. Maybe this might be interesting to someone.
After a user is created using the registration form, I create a new post type entry (already existing) and assign the custom field values submitted to the new entry. I prefer this solution because I have now maximum control of new post type and can now use the normal view loop and equally assign taxonomies and relationships.
code: XXX = id of my user form
add_action('cred_save_data', 'my_save_data_action',10,2);
function my_save_data_action($post_id, $form_data)
{
if ($form_data['id']==XXX)
{
$userid = $post_id;
//this is where you will insert your post as described below
// Create post object
$my_post = array(
'post_title' => $_POST['first_name'].' '.$_POST['last_name'],
'post_content' => '',
'post_status' => 'publish',
'post_author' => $post_id,
'post_type' => 'registered-user'
);
// Insert the post into the database
$post_id = wp_insert_post( $my_post );
// get user field
$photo = get_user_meta( $userid, 'wpcf-profile-picture', true );
$email = $_POST['user_email'];
$profession = get_user_meta( $userid, 'wpcf-profession', true );
$state = get_user_meta( $userid, 'wpcf-state-reg', true );