Hello. Thank you for contacting the Toolset support.
The conditional statement you added looks correct to me.
However - I would like to know, do you want to grab the field value of the current logged in user? If yes, it looks ok to me and you say it is still not working. I need to check why it is not working and for that, I need a problem URL as well as admin access details.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
I ended up sorting it out myself. That code works perfectly fine placed in a page, but wasn't working inside the page builder I was using. I suspect it was due to the nesting of shortcodes etc.
I ended up just writing a shortcode to achieve the same thing:
function check_college_admin_status() {
$user = wp_get_current_user();
$user_id = $user->ID;
$is_college_admin = get_user_meta( $user_id, 'wpcf-college-administrator', true );
if ( $is_college_admin == 1 ) {
return "You're a college administrator.";
} else {
return "Sorry, you're not a college administrator.";
}
}
add_shortcode( 'college-admin', 'check_college_admin_status');