Customizing Return of a comment

Hello

I already create my own comment form. The next step ist to create the code which validates the form.

The problem i have is to find, what happens if the submit button was pressed. I found out, that the validation is handled in the content.cfc. I learned, that the event cbui_preCommentPost will be used to place any messages, but i can’t find the “route” from pressing the submit button to the function validateCommentPost. This route i need to change to my own validation.

Thank you

Any idea how i can proceed with this?
Sorry for asking again, but this is the last piece of my ContentBox puzzle to do :wink:

Cheers

The route is slug/commentpost/

Thank you Andy. I will follow the route hoping i can to my things :wink:

Nearly everything you could do like this is already in the current templates, apart from the ajax ones, the others will have this in there if you wish to browse the default layouts.

Hello

After doing other stuff in ContentBox, i have to come back to this issue. First of all, i made a really nice experience with the plugin MessageBox, by extending it with my include to have my own formatting. Very cool stuff and easy to do :wink:

So, i’m trying to learn, how i can replace ContentBox internal code with my own. In this case i need to replace the private function validateCommentPost() completely, which is in the handler content.cfc

First, i had the idea to create my own event to replace commentpost and do my own thing. So far so good, but this would start a kind of a bomb, while blog.cfc and page.cfc are having a function commentpost. So, bad idea.

What would be the perfect way to accomplish this? Best practice?

Many thanks

Martin

AOP is what I do, but rather than replace it. You should be looking at extending it via the interception points.

May I ask what it is you are trying to do that requires you to replace that?

Thank you Andy

Can i find somewhere a typical example or do you have one for me? I usualy understand things better, if i can look into an example.

Thanks

Well AOP is easy really.

This should get you going in the right direction, feel free to ask any questions. But I don’t understand what your requirements is to remove that and not go with an interception point. If you can provide that maybe we can help more in what you are trying to achieve.

http://www.andyscott.id.au/blog/AOP-with-WireBox-within-ColdBox-or-ColdFusion

Well, the changes will not be really heavy stuff:

  • Localising all english strings, e.g. “Please provide a comment!”. i will use i18n for this.
  • Adding an additional field for answering a simple control question instead of using captcha. The answer needs to be transfered into the function, while the question can change from time to time.
  • Checking the comment against a JSON-file containing bad spam-words.
  • And maybe i will use some ideas taken from cfformprotect.

Yep best do all that in an interceptor.

The localisation will be easy as you translate that after it has done what it has done, the additional question can be done with the following blog post.

http://www.andyscott.id.au/blog/a-funky-way-to-replacing-captcha-in-contentbox

Checking the comment can be done with an interceptor as well, ContentBox has good support for this already, but you should be able to hook into this with the same interception point. Personally if Luis is reading this, it would be great if there was a pre/post Comment Interception point that would make this even easier.

At least with an interceptor, if you need to turn it off to check that it works in its default configuration, you just turn the interceptor off. I have written a few blog articles about over riding aspects or ColdBox and you can apply that too anything that is done through WireBox.

But yeah, in this case I would not override this function, rather extend its features with interceptors.

Okay, that will be my first adventure with ColdBox interceptors :wink: I will start reading your blog and docs learning more about interceptors…

Thanks again

Checking the comment against a JSON-file containing bad spam-words.

I think this is already built into ContentBox. Look under Comments > Settings > Moderation.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

if Luis is reading this, it would be great if there was a pre/post Comment Interception point that would make this even easier.

Joel will be putting together the COntentBox road map soon, so please put in any tickets for this kind of stuff so we can consider it!

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

For a super simple example of extending ContentBox with an interceptor, look through the code of my Blog Ping module I threw together a while back:

http://www.coldbox.org/forgebox/view/Blog-Ping

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Nope, it isn’t. Would be great to have that out of the box.

I have the plan to publish the word file on our CDN . This allows me to maintain it centraly and even other applications can use the file.

Thanks Brad, i will check out your code.

I have two text fields on that screen:

If a comment’s content, author ip or email address matches any of these keywords, the comment is automatically moderated. Regular expressions are ok.

If a comment’s content, author ip or email address matches any of these keywords, the comment is automatically rejected with no notifications. Regular expressions are ok.

What version of ContentBox are you on? With a simple interceptor you could load this list dynamically when the app starts up.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

I’m on v.1.6.0.00036 ColdBox: v.3.8.1.00076