Guest Book Comments - Restricting Number of Characters

Permalink
We are getting lots of comments in our guest book (good).
But, we have some people who feel the need to write a "Book" on what they think.

We'd like to limit the comments to a certain number of Characters - say 200 or less. (or variable depenind on the article responding to)

Any ideas, thoughts or helpful hints would be appreciated.

HOBOcs
 
shahroq replied on at Permalink Reply
shahroq
At the:
\concrete\core\controllers\blocks\guestbook.php
add this lines of code to action_form_save_entry() method (line 117)
if(strlen($_POST['commentText'])>10) {
  $errors['commentText'] = '- '.t("Comment is too long");
}

change 10 to whatever length you want.
HOBOcs replied on at Permalink Reply
HOBOcs
Thanks - I'll test this out.

I'm using 5.6.1.2
Ok basic question: If I'm making a change to the Guestbook.php where do I put My customized version? Root\block\??... for the \concrete\core\controllers\blocks\guestbook.php
shahroq replied on at Permalink Reply
shahroq
1- Copy \concrete\blocks\guestbook\*.* to \blocks\guestbook\*.*
2- open controller.php at the newly copied folder. you see 2 empty extended class.
add action_form_save_entry() method (from file: \concrete\core\controllers\blocks\guestbook.php) inside first class.
now you can modify this method instead of one in the core folder.
HOBOcs replied on at Permalink Reply
HOBOcs
Sorry don't know what you mean "Inside the controller" your 2 point.

The change is to the "Guessbook.php" I'm curious ..what does the guestbook/controller.php have to do with it.
Shouldn't guestbook.php just go to root\blocks\guestbook.php?
I wish to get it pointed correctly.
shahroq replied on at Permalink Reply
shahroq
for understanding how the 'overrides' at c5 works, check the documentation.
but in brief for a core blocks like guestbook we have this hierarchy:

\concrete\core\controllers\blocks\guestbook.php
->Inherit:
\concrete\blocks\guestbook\controller.php

now that you want to override a new class you should override from second one, so copy \concrete\blocks\guestbook\controller.php to \blocks\guestbook\controller.php

but the point is you want to modify a method from first one, so copy mentioned method from first class.
HOBOcs replied on at Permalink Reply
HOBOcs
Thanks - I'll read up to get a better understanding of overrides.