Hiding sensitive content to youngster from public reading.
-
I have found this HIDETHIS plugin for WorPress made by Mark Edwards.
Which hide all text of a post inside these tags <!–hidethis–>, <!–/hidethis–> when users are not logged.
My primary usage of this script is for preventing youngster public access to posts that sometime may contain sensitive content by hiding some part of it.
Although this plugin works fine, I would like to have the script enhanced to also display an short warning message within this specific post to advise users they most be logged to read the complete post. Again, this short warning must be specific to this post having these tags only.
Actually, that is the script:
*//
add_filter(‘the_content’, ‘hide_some_content’);
function hide_some_content($content) {
global $current_user, $user_ID;if (($current_user->id == 0) && ($user_ID == 0)){
$b = strpos($content, ‘<!–hidethis–>’);
$e = strpos($content, ‘<!–/hidethis–>’);$pre = substr($content,0,$b);
$suf .= substr($content,$e,strlen($content));return $pre.$suf;
} else { return $content; }
}*//
So basically, when a user is not logged, it should not only hide the text inside the <!–hidethis–> tags but also display warning message to users that the complete post is available ONLY if logged.Anyone have an idea how to?
- The topic ‘Hiding sensitive content to youngster from public reading.’ is closed to new replies.