I'm using a plugin that shows content only to specific user roles. This content is surrounded by a shortcode tag to make it invisible to other other user roles. Now I'd like to call other shortcodes inside that restricted content.
I understand that I need to set the plugins shortcodes up so that they use do_shortcode()
, but there are so many files that I'm not sure exactly where to do this. All of the places I've tried have not made any change. Any tips on what to look for?
Here's the code block I found. I think this is what I need to edit. What do you think? Change this:
return stripslashes($message);
Change to:
return stripslashes(do_shortcode($message));
// Show the level based protected shortcode message
function do_levelprotected_shortcode($atts, $content = null, $code = "") {
global $M_options;
// Set up the level shortcodes here
$shortcodes = apply_filters('membership_level_shortcodes', array() );
$notshortcodes = apply_filters('membership_not_level_shortcodes', array() );
$code = strtolower( $code );
if( substr( $code, 0, 4 ) !== "not-" ) {
if(!empty($shortcodes)) {
// search positive shortcodes first
$id = array_search( $code, $shortcodes );
if($id !== false) {
// we have found a level so we need to check if it has a custom protected message, otherwise we'll just output the default main on
$level = new M_Level( $id );
$message = $level->get_meta( 'level_protectedcontent' );
if(!empty($message)) {
return stripslashes($message);
}
}
}
} else {
if(!empty($notshortcodes)) {
// search positive shortcodes first
$id = array_search( $code, $notshortcodes );
if($id !== false) {
// we have found a level so we need to check if it has a custom protected message, otherwise we'll just output the default main on
$level = new M_Level( $id );
$message = $level->get_meta( 'level_protectedcontent' );
if(!empty($message)) {
return stripslashes($message);
}
}
}
}
EDITORS NOTE: I removed all the links to the (closed source) plugins as they're as relevant for the actual question as the plugins source code is accessible: zero.