Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-11-25 18:26:57

baby
Plugin Author
From: Buenos Aires, Argentina
Registered: 2005-10-16
Posts: 95
Website

modifying comment content 'on the fly' using event comment.save

Hi,

do I have a chance to modify the comment content when the user presses ‘save’?

That is, unlike the “comment.form” event, whose plugins are called within a str_replace(), I don’t know how to mangle the $message within a “comment.save” callback.

I see I can create an evaluator and ask textpattern to reload the form, but can I modify the form’s message (or name, email, web, for that matter)?

Could someone show me a small code sample?

TIA


Mariano AbsatzEl Baby

I don’t suffer from insanity. I enjoy every minute of it.

Offline

#2 2009-11-25 19:05:23

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: modifying comment content 'on the fly' using event comment.save

Did you see the sample on Textbook?

It looks like nko_spamurl_blocker may be a good example as well.

Last edited by MattD (2009-11-25 19:14:10)


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#3 2009-11-26 18:28:35

baby
Plugin Author
From: Buenos Aires, Argentina
Registered: 2005-10-16
Posts: 95
Website

Re: modifying comment content 'on the fly' using event comment.save

MattD wrote:

Did you see the sample on Textbook?

Yes… and a couple of other plugins (mem_akismet and rah_comment_spam)… but all of them deal with reading the content and marking the comment as spam or send it to moderation… or even giving the user a possibility to re-write the message and re-post it… what I want is to modify the comment text, and I don’t see how…


Mariano AbsatzEl Baby

I don’t suffer from insanity. I enjoy every minute of it.

Offline

Board footer

Powered by FluxBB