you need to edit the plugin which provided this shortcode [password-protect] (please post a link to that plugin).
and find where it returns the output; then add the do_shortcode() there.
example only (will be different in your actual plugin):
at the end of the actual function in the plugin:
return $protected;
}
turn that into:
return do_shortcode($protected);
}
please post a (download) link to the ‘protect’ plugin.
Thread Starter
MrRedd
(@mrredd)
Thread Starter
MrRedd
(@mrredd)
Ok..I just opened the plugin file for the Exclusive Content Password plugin…here is ALL the code on the bottom of the page.
Hopefully this will post right since there is no preview button and it’s my first attempt at posting code.
add_shortcode("password-protect", "ecpp_handler");
function ecpp_handler($atts, $content = null) {
global $cpp_html, $ecpp_global_password;
extract(
shortcode_atts(
array(
"password" => $ecpp_global_password
),
$atts
)
);
// This stores a session PASSWORD for each item..wether its individual or global..this is what will unlock it
$perm_hash = md5(get_permalink()) . md5($content);
$_SESSION[$perm_hash]['password'] = $password;
// this sets the global password in a session variable
$_SESSION['global_password'] = $ecpp_global_password;
if(!isset($_COOKIE["cpp-$perm_hash"])){
$content = str_replace('{TPLCPP_PERMHASH}', $perm_hash, parse_template($cpp_html));
}
return $content;
}
?>
right at the end of content-password-protect.php in the plugin’s folder, change:
return $content;
to:
return do_shortcode($content);
or follow the solution in this topic:
http://ww.wp.xz.cn/support/topic/plugin-exclusive-content-password-protect-no-evaluation-of-shortcodes?replies=2
(not tested with ngg)
Thread Starter
MrRedd
(@mrredd)
YES!…that did the trick 🙂
Thank you very much.
Since I am here though and this really didn’t tell me why it worked…can you tell me what “the_content” is referring to etc.
From the topic you posted above:
already found the solution: just add this line BEFORE the final ‘return $content;’ of the main plugin file ‘content-password-protect.php’:
$content = apply_filters(‘the_content’, $content);
I get that $content is the output…a filter gets added to do something to it differently and then it gets displayed again…but what does “the_content” do?
Sorry if it’s a dumb question…lol
kind of difficult to explain;
all post and page content gets by default filtered with the ‘the_content’ filter, which for instance takes care of the ‘more tag’, turning shortcodes into output, etc.
http://codex.ww.wp.xz.cn/Plugin_API/Filter_Reference/the_content
http://codex.ww.wp.xz.cn/Plugin_API/Filter_Reference
Thread Starter
MrRedd
(@mrredd)
Hmm…it sounds like it may be a place holder for the script to use in order to do the filtering??
Like..name $content to the_content then do all the stuff…then rename it to $content with the filters done?
Does that sound right?
Probably not but that’s what I am seeing…lol
And how about this question…
Using the above example:
$content = apply_filters('the_content', $content);
What (and where) are the filters that are getting applied?
I would expect to see something like apply_filter(UPPERCASE) or something…and yes that’s a bad example but I don’t know any filters yet..lol
Man I think I need sleep…I am confusing myself as I am typing this 🙂
the default filter are set in /wp-includes/default-filters.php; example:
add_filter( 'the_content', 'wptexturize' );
add_filter( 'the_content', 'convert_smilies' );
add_filter( 'the_content', 'convert_chars' );
add_filter( 'the_content', 'wpautop' );
add_filter( 'the_content', 'shortcode_unautop' );
add_filter( 'the_content', 'prepend_attachment' );
each of the names are referring to some functions which might be in any of the /wp-includes templates (or other folders);
to find the code of functions, check for instance:
http://phpxref.ftwr.co.uk/wordpress/nav.html?_functions/index.html
where you get an alphabetical functions list …
click on a function name …
this opens a new page, where you could click on the link below ‘Defined at:’ (this already shows the folder and template file name)
this then opens the corresponding template file, and moves to the correct position in the file to show the full function (this is somtimes quite slow and might take a while …)
Thread Starter
MrRedd
(@mrredd)
to find the code of functions, check for instance:
http://phpxref.ftwr.co.uk/wordpress/nav.html?_functions/index.html
Wow that is a lot of functions…doh!
That page isn’t a standard wordpress install is it?
Meaning my site wouldn’t look like that with that many would it?
Also…you showed the list of filters and where to find them (which is great) but I am still confused as to what filter is being applied when using the mentioned code:
$content = apply_filters('the_content', $content);
Thanks for all your help so far.