// ------------------ If user is shortcode------------------------
/* print content of enclosing shortcode if user is of role attribute */
function check_user_role( $atts, $content = null ) {
extract( shortcode_atts( array(
'role' => 'role' ), $atts ) );

if( current_user_can( $role ) ) {
return $content;
}
}

/*
[---user_role role="administrator"]
You can see this text if you are an administrator.
[---/user_role]
[---user_role role="subscriber"]
You can read this if you are a common subscriber.
[---/user_role]
Anyone can read this text.*/
add_shortcode( 'user_role', 'check_user_role' );