• Resolved sanumolu5

    (@sanumolu5)


    Hi,

    I have a Registration page which is using Fluent forms (Free version) to create a user account.

    1. I would like to create wp user profile when this form is submitted. Currently it is only creating an entry under Fluent Forms plugin.
    2. I am unable to check for the match of password, repeat password.

    Please kindly give pointers to achieve this functionality with free version of Fluent Forms itself. I tried to use the following hook, which is not complete, and to whatever extent it is coded, it did not work.

    add_action('fluentform_before_insert_submission', 'create_wp_user_profile', 10, 3);
    
    function create_wp_user_profile($insertData, $data, $form)
    {
        echo 'entered fluentform_before_insert_submission : ' . $form->id;
       if($form->id == 3) {
          return;
       }
    
        $username = sanitize_user($insertData['username']); // Replace 'username_field' with the field name for the username in your form
        $email = sanitize_email($insertData['email']); // Replace 'email_field' with the field name for the email in your form
        $password = $insertData['password']; // Generate a random password
    
        // Create the WordPress user
        $user_id = wp_create_user($username, $password, $email);
    
        // Check if the user was created successfully
        if (!is_wp_error($user_id)) {
            // You can add more user meta data here if needed
            // For example, use $insertData['field_name'] to retrieve the form data for custom fields
    
            // Update the user display name
            $display_name = $insertData['names'];
            wp_update_user(array('ID' => $user_id, 'display_name' => $display_name));
    
            // You can perform other actions after creating the user profile
            // For example, you can send a welcome email using wp_mail() function
    
            // You can also redirect the user after successful registration
            // For example, use wp_safe_redirect() to redirect to a specific page
            // wp_safe_redirect('https://example.com/thank-you');
            // exit;
        }

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Support Tahmid ul Karim

    (@tahmidulkarim)

    Hi @sanumolu5,

    There is a user registration feature in FluentForms Pro. So, if you upgrade to the Pro version, you can use that feature to create a user account and you won’t need any custom codes for that. Please check our documentation here.

    Thank you!

Viewing 1 replies (of 1 total)
  • The topic ‘Integrating Fluent Forms with wp user profile’ is closed to new replies.