• Resolved actualiza

    (@actualiza)


    Hi,
    I am using version 14.11.2 of cforms2.
    I need to retrieve the form data (email, password and user) from the form and create a wordpress user.
    I´ve read that I need to change the function ‘my_cforms_ajax_filter’ from ‘my_functions.php’ file, but this file doesnt exist in the latest version of Cforms.

    https://wordpress.org/plugins/cforms2/

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

    (@bgermann)

    Please have a look at my-functions.php.txt.

    Thread Starter actualiza

    (@actualiza)

    I tried adding the wordpress function ‘wp_create_user’ in the function ‘my_cforms_ajax_filter’ of my-functions.php.txt but is not working.

    I also add in the add_action ‘cforms2_after_processing_action’ but nothing.

    Plugin Author bgermann

    (@bgermann)

    Okay. Can you paste the exact code here (use code markup)? Did you just edit the txt file or did you remove .txt etension and enable the plugin?

    Thread Starter actualiza

    (@actualiza)

    I’m just editing the txt file.
    I only add the wp_create_user function:
    function my_cforms_ajax_filter($formID) {
    ### See my_cforms_filter
    wp_create_user(“name”, “password”, “email@email.com” );
    }

    I also tried adding the same function in the add_action function.

    Plugin Author bgermann

    (@bgermann)

    Okay. You do not know how to use a PHP function, do you? If you read through the file there are steps to take to make it being recognized by the PHP interpreter (look for “TO USE THE FUNCTIONS”). The way you are using wp_create_user now means that a user “name” is created with password “password” and email “email@email.com”. You would have to exchange the parameters by something from your form. You can see it in the example how to get the posted information.

    Thread Starter actualiza

    (@actualiza)

    All I want is to create a user with these parameters (name, password and email@email.com).
    I rename the file to ‘my-functions.php’ and the plugin is activated.
    I include the function wp_create_user to my_cforms_ajax_filter but the user is not created in wordpress.

    Plugin Author bgermann

    (@bgermann)

    Now you have to use cforms so that the function is called. It is called on successfull submission of one of your defined forms.

    Plugin Author bgermann

    (@bgermann)

    Actually you can also read this in my-functions.php.txt. This forum is not a replacement for reading through the documentation.

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

The topic ‘Create user with data from cforms2’ is closed to new replies.