User registration

Home Forums Quform WordPress User registration

This topic is: resolved
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #6715
    RobLane
    Participant

    I have tried adding the relevant code to the functions.php file. However I receive an error when I submit the form. I’m not sure what the issue might be. Please could you help.
    Here is a copy of my functions.php file with Quform added at end. I have changed the Unique ID and the form ID as per the guide. Any assistance would be greatly appreciated.
    Thanks in advance, Rob.

    <?php
    /**
    * @package WordPress
    * @subpackage ASI Theme
    * @since IOA Framework V 1.0
    */

    /**
    * Localization code
    */
    load_theme_textdomain('ioa',get_template_directory() .'/language'); // Localization Support

    $locale = get_locale();
    $locale_file = get_template_directory() ."/language/$locale.php";
    if ( is_readable($locale_file) )
    require_once($locale_file);

    /**
    * Define Constants
    */
    define('HPATH',get_template_directory() .'/backend');
    define('HURL',get_template_directory_uri().'/backend');
    define('PATH',get_template_directory() );
    define('URL',get_template_directory_uri());
    define('CHURL',get_stylesheet_directory_uri());

    /**
    * Load the main file that initializes all core classes , panels and functions.
    */

    require_once(HPATH.'/superloader.php');

    /**
    * Quform.
    */
    function mytheme_check_username_exists($valid, $value, $element)
    {
    if (username_exists($value)) {
    $element->addError('This username is already taken');
    $valid = false;
    }

    return $valid;
    }
    add_filter('iphorm_element_valid_iphorm_3_5', 'mytheme_check_username_exists', 10, 3);

    function mytheme_check_email_exists($valid, $value, $element)
    {
    if (email_exists($value)) {
    $element->addError('This email address is already registered');
    $valid = false;
    }

    return $valid;
    }
    add_filter('iphorm_element_valid_iphorm_3_3', 'mytheme_check_email_exists', 10, 3);

    function mytheme_register_wp_user($form)
    {
    $username = $form->getValue('iphorm_3_5'); // Change to your username field unique ID
    $email = $form->getValue('iphorm_3_3'); // Change to your email field unique ID
    $password = $form->getValue('iphorm_3_4'); // Change to your password field unique ID

    wp_insert_user(array(
    'user_login' => $username,
    'user_pass' => $password,
    'user_email' => $email
    ));
    }
    add_action('iphorm_post_process_3', 'mytheme_register_wp_user', 10, 1);

    #6718
    RobLane
    Participant

    Just re-read my post and I haven’t explained the problem very well. Basically I have created a registration form that I would like users to fill out and when they press submit, a user account is created for them from the details in the form. eg username, password, email address.

    I have read the creating-a-user guide but when I press submit I receive an error

    #6729
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #6747
    RobLane
    Participant

    Hi Ally,

    thanks for the reply. I finally figured out that my email settings were incorrect.
    I have set them to SMTP and it is now working

    Regards

    Rob

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy