It's possible that using the "Switch User" plugin is not a good way to test..
Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
I've again adjusted the code as per your requirement to the custom code section.
add_filter( 'wpv_filter_force_template', 'prefix_fixed_content_for_visitors', 99, 3 );
function prefix_fixed_content_for_visitors( $template_selected, $id, $kind ) {
global $current_user;
global $post;
if(is_singular("profile")) {
if((in_array('student',$current_user->roles) and $post->post_author != $current_user->ID) and (!in_array('administrator',$current_user->roles) or !in_array('manager',$current_user->roles))
){
$template_selected = 1158;
}
}
return $template_selected;
}
Can you please confirm it works now.
It seems to work perfectly! Thank you very much for your patience and help!
I had tried that exact way myself, but looking at your code, I think I'd put the ending } at the wrong place for the outside loop to check for the profile.
Thanks a million!
Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
Great - please feel free to mark resolve this ticket.
My issue is resolved now. Thank you!