• Resolved drewrawitz

    (@drewrawitz)


    Hello,

    I seem to be having some trouble, I’m trying to receive the posted data and it doesn’t seem to be returning anything. Am I doing something wrong?

    function wpcf7_do_something ($cf7) {
        print_r($cf7->posted_data);
    }
    add_action("wpcf7_before_send_mail", "wpcf7_do_something");

    https://wordpress.org/plugins/contact-form-7/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Rob W

    (@robertark)

    I was having the same issue… there’s been some major changes in 3.9.

    See: http://contactform7.com/2014/07/02/contact-form-7-39-beta/

    Notice how the access and visibility has changed.

    Thread Starter drewrawitz

    (@drewrawitz)

    Thanks so much Rob, that helps a lot.

    Rob W

    (@robertark)

    Here’s how you can get the data:

    add_action('wpcf7_before_send_mail', 'my_wpcf7_before_send_mail');
    function my_wpcf7_before_send_mail($form) {
      $submission = WPCF7_Submission::get_instance();
      $data = $submission->get_posted_data();
    }
    tgfrules

    (@tgfrules)

    Even it’s not my issue – that solved it for me.

    Thanks Rob 🙂

    Brim

    (@brim)

    +1 to thanks 🙂

    Snerfus

    (@snerfus)

    Ok, that solved my issue for the posted_data, but it does not work for uploaded_files (trying get_uploaded_files(), and it crashes)
    $submission->uploaded_files[‘file-787’], also does not work (crash)

    Thanks

    Snerfus

    (@snerfus)

    Looks like it is $submission->uploaded_files()
    What a huge change for 3.9, would have been nice if this was properly documented, its a huge change.

    Rob W

    (@robertark)

    I agree, there should be some dev docs instead of browsing through a blog… even the blog doesn’t document everything.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Can't get posted_data’ is closed to new replies.