Unfortunately, not everything from what you wrote I understood.
I have two roles: "customer" and "dealer".
I made a "user-type" user field and added them to the registration forms. It writes for "customer" the value "1" and for "dealer" value "2".
For this is the code:
add_action('cred_save_data_37', 'my_save_data_user_for_customer',10,2);
function my_save_data_user_for_customer($post_id, $form_data){
if ($form_data['id']==37){
update_user_meta($post_id, 'wpcf-user-type', $_POST['user-type']);
}
}
add_action('cred_save_data_112', 'my_save_data_user_for_dealer',10,2);
function my_save_data_user_for_dealer($post_id, $form_data){
if ($form_data['id']==112){
update_user_meta($post_id, 'wpcf-user-type', $_POST['user-type']);
}
}
For this is created shortcode [get_user_type]:
function func_get_user_type( $atts ){
if(isset($_GET['author_id'])){
$author_id = $_GET['author_id'];
$x = get_user_meta($author_id,'wpcf-user-type',true);
return $x;}
}
add_shortcode('get_user_type', 'func_get_user_type' );
I used this shortcode on one of the subpages:
[wpv-conditional if="( '[get_user_type]' eq '1' )"]
[wpv-view name="profil-customer"]
[/wpv-conditional]
[wpv-conditional if="( '[get_user_type]' eq '2' )"]
[wpv-view name="profil-dealera"]
[/wpv-conditional]
And it works well.
Now I used [get_user_type] in Toolset "Content Template" and it does not work.
[wpv-conditional if="( '[get_user_type]' eq '1' )" ]
<div class="">[types usermeta='phone-customer'][/types]</div>
[/wpv-conditional]
[wpv-conditional if="( '[get_user_type]' eq '2' )"]
<div class="">[types usermeta='phone-dealer'][/types]</div>
[/wpv-conditional]
The debugger shows me this information:
wpv-conditional attributes
####################
Array
(
[if] => ( '' = '1' )
[debug] => true
)
####################
Debug information
####################
--------------------
Original expression: ( '' = '1' )
--------------------
After replacing 1 general variables and comparing strings: ( '' = 1 )
Comparing to 1
(This for [wpv-conditional if="( '[get_user_type]' eq '1' )" ])
But for me it does not mean anything, I do not understand it. I guess that [get_user_type] is invisible, unread, yes?
If I have described something unclean, or missing any explanation, please write what.
"I'm not sure from your other ticket what you ended up with in terms of your URL structure and parameters, could you confirm that?" - I do not understand this question 🙁