Thank you for waiting while I performed some troubleshooting on your website's clone.
I noticed that the issue seems specific to few users, for which the user meta entry for key "wp_9xbrh8d4d7_capabilities" is saved differently, in the "wp_9xbrh8d4d7_usermeta" table.
For example, for the user "temporaryadmin" with user ID "2124", the capability metadata is saved as:
a:14:{s:26:"wpcf_custom_post_type_view";b:1;s:26:"wpcf_custom_post_type_edit";b:1;s:33:"wpcf_custom_post_type_edit_others";b:1;s:25:"wpcf_custom_taxonomy_view";b:1;s:25:"wpcf_custom_taxonomy_edit";b:1;s:32:"wpcf_custom_taxonomy_edit_others";b:1;s:22:"wpcf_custom_field_view";b:1;s:22:"wpcf_custom_field_edit";b:1;s:29:"wpcf_custom_field_edit_others";b:1;s:25:"wpcf_user_meta_field_view";b:1;s:25:"wpcf_user_meta_field_edit";b:1;s:32:"wpcf_user_meta_field_edit_others";b:1;s:13:"administrator";b:1;s:13:"bbp_keymaster";b:1;}
Usually, the user role information is the first item in this serialized data, like this:
a:14:{s:13:"administrator";b:1;s:13:"bbp_keymaster";b:1;s:26:"wpcf_custom_post_type_view";b:1;s:26:"wpcf_custom_post_type_edit";b:1;s:33:"wpcf_custom_post_type_edit_others";b:1;s:25:"wpcf_custom_taxonomy_view";b:1;s:25:"wpcf_custom_taxonomy_edit";b:1;s:32:"wpcf_custom_taxonomy_edit_others";b:1;s:22:"wpcf_custom_field_view";b:1;s:22:"wpcf_custom_field_edit";b:1;s:29:"wpcf_custom_field_edit_others";b:1;s:25:"wpcf_user_meta_field_view";b:1;s:25:"wpcf_user_meta_field_edit";b:1;s:32:"wpcf_user_meta_field_edit_others";b:1;}
For all such users which don't have the user role information, saved as the first item, the [wpv-current-user info='role'] shortcode doesn't work.
These findings have already been shared with the concerned team for further review and I'll keep you updated on the progress through this ticket.
For now, a workaround can be to register a custom shortcode to get the user role, that uses a different approach:
function get_user_role_func( $atts )
{
$a = shortcode_atts( array(
'userid' => ''
), $atts );
$userdata = get_user_by('ID', $a['userid']);
$user_roles = $userdata->roles;
$user_role = array_shift($user_roles);
return $user_role;
}
add_shortcode( 'get_user_role', 'get_user_role_func' );
The above code snippet can be included through either Toolset's custom code feature ( ref: https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/ ) or through active theme's "functions.php" file.
Next, please add "get_user_role" in the "Third-party shortcode arguments" section, at WP Admin -> Toolset -> Settings -> Front-end Content.
Using this new shortcode, you'll be able to get the user's role like this:
[get_user_role userid="[wpv-current-user info='id']"]
And the same can be used in the conditional block as:
[wpv-conditional if="( '[wpv-post-author format='meta' meta='ID']' eq '[wpv-current-user info='id']' ) OR ( '[get_user_role userid="[wpv-current-user info='id']"]' eq 'administrator' )"]
Show this only if the logged-in user is the post author or has administrator role
[/wpv-conditional]
I hope this helps and please let me know if you need any further assistance around this.
regards,
Waqar