Open alanski66 opened 2 months ago
Hello @alanski66! Can you tell me which custom forms will be checked by listening to EVENT_BEFORE_SAVE?
It's more that the fields above are on your form $entry->YOURFORMFIELD YOURFORMFIELD is something you want to check for spam in your form - the save event will listen to all entry saves and you are just saying if this save event contains my form field pass it to the clean talk spam check service. Hth
PS it works brilliantly
Thanks @alanski66! We will try to implement EVENT_BEFORE_SAVE listening in the future. Case ID: 12589
If you want to simply add a check on other custom forms you can add another event listener in the main file 'CraftAntispam.php' function registerEvents()
Event::on( Entry::class, Element::EVENT_BEFORE_SAVE, function (Event $e) { $entry = $e->sender; $params['email'] = $entry->YOURFORMFIELD; $params['message'] = $entry->YOURFORMFIELD; if ($this->request->getIsSiteRequest()) { $result = $this->antispam->checkSpam($params); } }, );