• Resolved gerobe

    (@gerobe)


    Hello,

    I just upgraded to version 14.11 of the plugin and noticed, that the my-functions.php is deprecated. I have some forms with a data check afterwards and I have to change this now. I’m not that deep into programming and the comment lines:

    * The preferred way of doing it is via WordPress actions and filters.
    * You find their ‘cforms2_’ prefixed names at the apply_filters and do_action calls.

    do not really help me with changing this. As far as I understand I have to put the processing in the functions.php of my theme, right? But what does it mean, that I can find their ‘cforms2_’ prefixed names at the apply_filters and do_action calls?

    The most I learn from examples. But I can’t find any example code of how to process form data. There used to be examples for the old methods which I could use. But without any concrete examples I’m not able to change my processing code. And I can’t find any hints in the cforms-help either.

    It would be great to have two or three example how to access and change form submissions.

    https://www.ads-software.com/plugins/cforms2/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author bgermann

    (@bgermann)

    Thread Starter gerobe

    (@gerobe)

    But exactly that file is my problem. The information is confusing. I read the word deprecated many times, so which passages are old and new. Where exactly can I find the “their ‘cforms2_’ prefixed names at the apply_filters and do_action calls”. A simple step-by-step guide or information would be great.

    As far as I understand the functions should still be implemented as a plugin and there is no need to have routines for ajax and non-ajax forms anymore(?). But how do I call these filters?

    Plugin Author bgermann

    (@bgermann)

    Look close and you’ll see the line
    add_action('cforms2_after_processing_action', function ($cformsdata) {

    You can find other filters and actions by searching through the source code for the given terms (apply_filters, do_action). You can find more information on WordPress filters and actions by just googling for them. The old functions my_…() are still implemented, but will be removed in the future.

    jbauguss

    (@joshbaugussnet-1)

    Can’t you guys just document the hooks better for us? We shouldn’t have to go hunting for these things.

    Is there going to be a point in time where if we don’t have the add_action method then the old my_cforms_action will stop getting called altogether? I have already converted the my-functions.php file to a plugin, but you hadn’t introduced the add_action method yet when I did that step.

    I’ve searched with grep for do_action and apply_filter. Most are related to comments. I see the cforms2_after_processing_action in the lib_nonajax.php script.

    What I don’t see are replacements for custom form validation functions. One thing I was able to do before was to do a rudimentary check for spammers. I’d validate fields like phone to make sure no letters were used…I’d validate first and last name to make sure they weren’t the same values…(both of these these spammers do a lot) I was able to use the my_cforms_logic for this. (admittedly it was ugly but it worked. If I detected spam I’d just set the adminTo to a dummy address and set the error message to something like “go away spammer”

    Plugin Author bgermann

    (@bgermann)

    The problem with good documentation is: It needs extra time that I do not have for this hobby project. The focus for now is fixing bugs and simplifying the source. The in-source documentation of the hooks make them better trackable for me as a developer. And grepping the source is not too much work if you want to use the API, I think.

    The old hooks are deprecated and not removed up to now. For some there will be replacements, but some will be killed. But this will need some more months.

    Btw. please do not post at resolved issues as usually I will not recognise the new post then.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to: Process form-data after submission’ is closed to new replies.