Oh, okey, i see that we are working on the same type of project
In fact i was asking for that hoping to make things simplier.
I saw that post :
And like i shared here for a repeater and shortcode for the “Listing” Page/Template
I’d like to do the same but for users.
I am trying to create a custom “User” page and i need to retreive all attribute as shortcode.
But so far i just manage to do it but it shows the custom attribute of the loggued user.
Not the user profil we are browsing : (and of course you dont see anything if you are not logged)
add_shortcode('show_user_attribute', function($atts) {
// Allow manual override with user_id parameter
$atts = shortcode_atts([
'user_id' => null
], $atts);
$user_id = null;
// If specific user_id is provided in shortcode
if ($atts['user_id']) {
$user_id = intval($atts['user_id']);
}
// If on user profile page, get that user's ID
elseif (is_singular('hp_user')) {
$user_id = get_post_meta(get_the_ID(), 'hp_user', true);
}
// Otherwise get current logged-in user
else {
$user_id = get_current_user_id();
}
if (!$user_id) return '';
return get_user_meta($user_id, 'hp_user_test_attribut', true);
});
If you want to have the attributes be displayed on the login form, they need to set at the user level (as I mention earlier), not vendor’s (and set as required, as you understood).
If you want to embed the login form in a page (instead of a popup), use the following block :
PS : Yes, you right, the hack I use is just a workaround, user are not set directly as “vendor”, but it’s fine by me : I designed my website so that only vendor (according to the “type” attribute) can publish listings (add requests is not available). And only customers can publish requests (add listings is not available).
I must have definitely missed something and i don’t really know what but I just have the setup I described before and just have the “Age” as a required fields for vendors for my beta site.
Thanks for the embed login form but this is the same as the popup ?
We don’t have at the equivalent to directly access the “register” one ?
Anyway, that is not that important, now I fill the 3 fields, username, email and password and once submitted I am directly redirected to the “profile completition” where I am “invited” to complete all the vendor custom attributes i setup.
This is why at least ONE needs to be mandatory to fully validate that form and THEN the account becomes a vendor.
I am just writing that in case that can helps anybody else to understand a bit better