2

I was browsing a Magento event cheat sheet because I was hoping to find an event: review submit save before ... and capture the title/name/text from the description. And set the review to deleted or dissaproved if certain strings are shown - like "href" or "http" http://www.nicksays.co.uk/magento-events-cheat-sheet-1-7/

We are currently seeing so much spam in our review forms that a quick check for these two strings would filter out 99% ...

I would be hoping to turn this into a simple extension where keywords in the backend can be separated by commas and these are then looked for in the reviews

Question: is there such an event? and how would I go about capturing the values and check for the forbidden words

1 Answer 1

3

You could use an event dispatched when saving a review review_save_before for example.

9
  • top! Just what I am looking for - and is review_save_before an existing (real) event or just an example
    – snh_nl
    Sep 9, 2014 at 14:46
  • It actually exists. It is dispatched by this line Mage::dispatchEvent($this->_eventPrefix.'_save_before', $this->_getEventData()); in Mage_Core_Model_Abstract::_beforeSave(). and when saving a review the _eventPrefix is review.
    – Marius
    Sep 9, 2014 at 14:48
  • And do you think I can cancel or dissaprove the review this way? (Or only exit the function and redirect)
    – snh_nl
    Sep 9, 2014 at 15:29
  • You can can manage to set _dataSaveAllowed on the review model instance then it won't be saved. But unfortunately I don't know how you can set that because it's a protected member and there is no setter for it. You can try with Reflection.
    – Marius
    Sep 9, 2014 at 15:34
  • I was fiddling with this. And suppose we just return the URL with error messages "cannot save illegal characters" the we should also be done ... Gets the job done
    – snh_nl
    Sep 10, 2014 at 20:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.