Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-09-28 05:05:34

floodfish
Member
From: Brooklyn, NY
Registered: 2007-01-11
Posts: 155
Website

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

#2 2007-10-08 17:50:08

obeewan
Archived Plugin Author
From: Stockholm, Sweden
Registered: 2004-08-12
Posts: 319
Website

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

#3 2007-10-08 21:51:57

floodfish
Member
From: Brooklyn, NY
Registered: 2007-01-11
Posts: 155
Website

Re: how can I allow commenters to include basic html?

Thanks Henrik! I’ll nose around there a bit …

Offline

#4 2007-10-09 04:27:29

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,330
Website Mastodon

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

Board footer

Powered by FluxBB