diff --git a/core/um-shortcodes.php b/core/um-shortcodes.php index beaa9bf9..edfcf2c8 100644 --- a/core/um-shortcodes.php +++ b/core/um-shortcodes.php @@ -13,7 +13,7 @@ class UM_Shortcodes { add_shortcode('um_loggedin', array(&$this, 'um_loggedin')); add_shortcode('um_loggedout', array(&$this, 'um_loggedout')); add_shortcode('um_show_content', array(&$this, 'um_shortcode_show_content_for_role') ); - + add_filter('body_class', array(&$this, 'body_class'), 0); @@ -514,38 +514,38 @@ class UM_Shortcodes { /** * Shortcode: Show custom content to specific role - * + * * Show content to specific roles * [um_show_content roles='member'] [/um_show_content] * You can add multiple target roles, just use ',' e.g. [um_show_content roles='member,candidates,pets'] - * + * * Hide content from specific roles * [um_show_content not='contributors'] [/um_show_content] * You can add multiple target roles, just use ',' e.g. [um_show_content roles='member,candidates,pets'] - * - * @param array $atts + * + * @param array $atts * @param string $content * @return string */ function um_shortcode_show_content_for_role( $atts = array() , $content = '' ) { global $user_ID; - + if( ! is_user_logged_in() ) { return; - } + } $a = shortcode_atts( array( 'roles' => '', 'not' => '', ), $atts ); - + um_fetch_user( $user_ID ); $current_user_role = um_user('role'); if( isset( $a['not'] ) && ! empty( $a['not'] ) && isset( $a['roles'] ) && ! empty( $a['roles'] ) ){ - return $content; + return do_shortcode( $content ); } if( isset( $a['not'] ) && ! empty( $a['not'] ) ){ @@ -553,21 +553,21 @@ class UM_Shortcodes { $not_in_roles = explode(",", $a['not'] ); if( is_array( $not_in_roles ) && ! in_array( $current_user_role, $not_in_roles ) ){ - return $content; + return do_shortcode( $content ); } }else{ $roles = explode(",", $a['roles'] ); - + if(is_array( $roles ) && in_array( $current_user_role, $roles ) ){ - return $content; + return do_shortcode( $content ); } - + } return ''; } - + }