• Resolved manbearpig73

    (@manbearpig73)


    I’m using the Lite version of Formidable Form and from everything I have found I should be able to use the frm_after_create_entry hook. I have added a Newsletter field to my user profile page my own plugin. I’m trying to update this field when a user subscribes to the news letter from the website. If they are logged in the user profile is updated.

    This is my code but it’s not doing anything.

    add_action('frm_after_create_entry', 'joepotgieter_add_entry_id_to_user', 30, 2);
    function joepotgieter_add_entry_id_to_user($form_id) {
    if ($form_id == 3) { // my Newsletter form id
    // Check if the user is logged in
    if (is_user_logged_in()) {
    $user_id = get_current_user_id();
    error_log("User ID: " . $user_id);

    // Update the user meta field
    $updated = update_user_meta($user_id, 'newsletter_field', 'on');

    // Log success or failure
    if ($updated) {
    error_log("Successfully updated user meta for user ID: " . $user_id);
    } else {
    error_log("Failed to update user meta for user ID: " . $user_id);
    }
    } else { //Dont actually care about this as the form sends an email
    error_log("User is not logged in.");
    }
    }
    }

    Can anyone help with this?

    Joe

    • This topic was modified 3 months, 2 weeks ago by manbearpig73. Reason: Removed page I need help with link
Viewing 1 replies (of 1 total)
  • Plugin Support Njones35

    (@njones35)

    Hi Joe,

    Thank you for reaching out to us today. I see you’re having trouble with the frm_after_create_entry hook in the Lite version of Formidable Form.

    Unfortunately, support for debugging custom code is outside the scope of our support. However, we understand the importance of getting the functionality you need, and we want to help you find a solution.

    Our community is a great resource for finding help to fix your code. You can post your question on our community site at https://connect.formidableforms.com/. Our community members are knowledgeable and willing to offer assistance.

    Thank you for understanding, and please let us know if you have any further questions.

    Best,
    Nathanael

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