• Resolved fijisunshine

    (@fijisunshine)


    Great plugin! Some of my functions.php code no longer works after updating the plugin. This snippet is from a function that uses add_action on the “wpcf7_mail_sent” hook:

    $form_data = WPCF7_Submission::get_instance();
    if ( $form_data ) {
    $formdata = $form_data->get_posted_data();
    }
    $is_admin = $formdata[‘is_admin’];

    This worked on the older version of the plugin. Can you explain how to properly get $is_admin now? Thank you

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    Where can we see the website in question?

    Thread Starter fijisunshine

    (@fijisunshine)

    Hi Takayuki,

    Thank you for your response. This is a staging site so it’s run on localhost and isn’t online. To help you, I see this error in debug log: “PHP Notice: Undefined index: is_admin …”

    These snippets also stopped working:

    $posttype = $formdata[‘posttype’];
    $cf7form_id = $formdata[‘_wpcf7’];
    $post_id = $formdata[‘post_id’];

    But I managed to fix them by using this code:

    $url = $form_data->get_meta(‘url’);
    $postId = url_to_postid($url); // Get the post_id
    $postType = get_post_type($postId); // Get the post_type
    $contact_form = $form_data->get_contact_form();
    $cf7form_id = $contact_form->id(); // Get the CF7 form ID

    As a result, it’s just $is_admin that I’m unable to get. Can you assist? Thanks again

    Thread Starter fijisunshine

    (@fijisunshine)

    Issue resolved. The issue was unrelated to your CF7 plugin. Thanks again for your help.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Function using wpcf7_mail_sent no longer working’ is closed to new replies.