• Resolved nasgaard

    (@nasgaard)


    I wrote a plugin a few years ago that uses the pdb-before_submit_update hook to validate info prior to updating the database. If there was erroneous info in the update record I returned an empty array, which seemed to work fine, no DB update was performed. Now, when an empty array is returned, PDB seems to null out most of the fields in that record for which the hook was called. Has there been some change in behaviour for this hook?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author xnau webdesign

    (@xnau)

    That filter is for the purpose of modifying the submission data or performing some other task based on the submitted data. It wasn’t intended to be used to prevent a submission from getting processed.

    Several months ago, we completely refactored how the submissions are processed, so that’s probably when your custom code stopped working as expected.

    The basic problem is that after that filter is applied to the data, the form submission is processed, and there’s no check to see if it should be processed or not at that point.

    The best filter to use if you want to abort a submission is pdb-check_submission, which expects a true or false in return. A function that uses that filter would inspect the $_POST array and it can abort the submission by returning a false. This filter is usually used to prevent spam or other unwanted submissions.

    Thread Starter nasgaard

    (@nasgaard)

    Thanks very much for your response. I will rework my plugin using your suggested API.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Problem with pdb-before_submit_update’ is closed to new replies.