Support » Plugin: Gwolle Guestbook » Checking entry input before storing in guestbook backend

  • Resolved gwdsupport

    (@gwdsupport)


    Hi there,

    I’m looking for a way to check (and possibly reject) a guestbook entry based on a customized filter.

    If the contents passes the check successfully, the entry goes into the Guestbook backend to be moderated.

    If not, the entry is rejected (with an error message) and no further action is required on the part of the guestbook moderator.

    Thank you for pointing me in the right direction.

    Best,
    Larry.

    • This topic was modified 1 month, 2 weeks ago by  gwdsupport.
Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Marcel Pol

    (@mpol)

    First time ever I get this question. Thank you.

    I thought there was a hook for this, but looking at the code there is not. I will add a hook for checking the entry.

    I will get back on this, hopefully today or tomorrow.

    Plugin Author Marcel Pol

    (@mpol)

    Hi, with 3.1.2 there is a hook to check the input. You can set an error that is either non-fatal or fatal.

    Example code
    https://plugins.trac.wordpress.org/browser/gwolle-gb/trunk/docs/filters/gwolle_gb_new_entry_frontend.txt

    If you need to add anything to the form, like an extra input field, look at a filter like this:
    https://plugins.trac.wordpress.org/browser/gwolle-gb/trunk/docs/filters/gwolle_gb_write_add_after_website.txt
    There are a few that are similar.

    Thank you very much.

    I’ll take a look and give it a go in the next few days.

    Best,
    Larry

    Plugin Author Marcel Pol

    (@mpol)

    Okay, good.

    What are you trying to do anyway?

    I want to filter the input my own way and reject the entry altogether before it reaches the backend in case of spam.

    I prefer not to see the spam in the backend and sort it out there.

    My goal is to minimize the task of the moderator.

    Maybe I didn’t find the right way to do it with the hooks already available before your new extension…

    Plugin Author Marcel Pol

    (@mpol)

    There is an option to refuse spam, did you see it?
    The included spamfilters like honeypot and timeout are quite good for spambots. Akismet and Stop Forum Spam can be quite good as well.

    Yes, I saw those possibilities.

    However it was my understanding that the entries would be marked as spam but still be in the backend to be “handled” by the moderator. And this is precisely what I want to avoid.

    Maybe I’m missing something…

    Being located in Germany, where the GDPR has everybody on their toes, I am a bit uneasy with external anti-spam services as their privacy policies may not agree with the german requirements.

    • This reply was modified 1 month, 2 weeks ago by  gwdsupport.

    Hello again,

    I have two questions:

    1. New hooks
    I took a look at the new hooks, but I’m not fit enough to achieve what I want to do.

    I’d like to do the following:

    If the entry ($entry?) contains words from an array, reject the entry and put out an error message.

    It would look something like that:

    $bad_words = array("list", "of", "bad", "words");
    
    foreach ($bad_words as $bad_word) {
    if (strpos($entry, $bad_word)!==false) {
    echo /or return/ "Your entry could not be sent.";
    
    }
    }

    So I need some advice on this.

    2. Form Layout:

    Is it possible to have the “Hinweis-Text” (with the privacy policy or equivalent) before the “Send” Button ?

    Thanks again for your help.

    Best,
    Larry

    Plugin Author Marcel Pol

    (@mpol)

    I am not here to write your code 🙂

    About the echo/return, the example code has a function call gwolle_gb_add_message, this will take care of the error that is seen by the user.
    The one with a fatal error is the one with true as second parameter. The non-fatal error message has a false as second parameter.

    About the privacy checkbox, I don’t know any good way to move that around. Maybe with CSS.

    Hello again and just as an FYI,

    I solved my second question by using the “gwolle_gb_write_add_form” hook.

    Regarding my first question, I’ll take my chances modifying the PHP scripts directly.

    Thanks.

    Best,
    Larry

Viewing 10 replies - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.