I know how to disable HTML in comments, but I’d like the ability to only have Admins be able to post links, or only Logged In users if need be, to have the ability to post links. Is this possible?
I am currently using this plugin.
I wrote the author of the plugin and he had this to say:
“The problem with the function is that it applies to all comments by using a filter. I’m not sure if it’s possible to add a condition to it. Instead, you’d have to create a new function: http://www.pastebin.com/q68qkKFX
Then, when you echo out your comment, you’d have to do something like this:
echo remove_comment_links($commentID, $commentTEXT);
But with the right variables ($commentID and $commentTEXT doesn’t exist). “
I used:
<?php $comment_text = get_comment_text();
$comment_id = get_comment_id();
echo remove_comment_links($comment_id, $comment_text); ?>
But it strips out all HTML from all users, instead.
Additional info by the OP
It seems that the OP “forgot” to tell, that he uses the following plugin:
The modified plugin
To make this work, we have to modify it slightly:
I’m not sure, but from a brief look it seems like that there’s only the
global $allowedtags;
for this – sadly no API (aside fromallowed_tags()
to simply display them).You can extend it, but from a look at core it should already be possible. Make sure that you turn off all plugins (incl. Spam(!!) and Caching plugins), before testing the following plugin.