Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
how can I allow commenters to include basic html?
I really don’t want my commenters to have to use textile, but I’d like them to be able to use some basic html, like italics or links.
Is there a way to stop textile from acting on comments entirely, or (more ideally) have it just apply typographic magic while still parsing html?
Last edited by floodfish (2007-09-28 05:09:03)
Offline
Re: how can I allow commenters to include basic html?
Well .. The comments use the restricted version of Textile and on line 333 in classTextile.php you will find:
$text = $this->encode_html($text, 0);
If you comment this one (add #
infront of the row) it won’t convert tags to entities. However, this makes it possible for users to use any (X)HTML tag in the form.
The whole restricting what (X)HTML tags to allow is another thing and to my knowledge there is nothing built into TXP therefor a search on the web for a PHP script that does just that and add it to the TextileRestricted
function is needed.
And do note that this will make updating your Textpattern trickier since if a new Textile version is packaged with a new release you will need to do the whole process all over again.
Another solution is add a callback on the comment_save that checks the info, coverts any links etc to Textile then goes through the normal process. This needs a bit of regular expressions which isn’t my really my area.
Plugins:
ob1_advanced_search 1.032b, ob1_search_score 1.0, ob1_pagination 2.5, ob1_title 4.1, ob1_modified 2.1
“Let your plans be dark and as impenetratable as night, and when you move, fall like a thunderbolt.”
— Sun Tzu
Offline
Re: how can I allow commenters to include basic html?
Thanks Henrik! I’ll nose around there a bit …
Offline
Re: how can I allow commenters to include basic html?
obeewan wrote:
Another solution is add a callback on the comment_save that checks the info, coverts any links etc to Textile then goes through the normal process.
May I suggest wet_comment_magic as a starting point, which does this already for links.
Offline