Home › Forums › Quform WordPress › User registration
- This topic has 3 replies, 2 voices, and was last updated 11 years, 3 months ago by RobLane.
- AuthorPosts
- October 1, 2013 at 6:27 pm #6715RobLaneParticipant
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 IDwp_insert_user(array(
'user_login' => $username,
'user_pass' => $password,
'user_email' => $email
));
}
add_action('iphorm_post_process_3', 'mytheme_register_wp_user', 10, 1);October 1, 2013 at 10:06 pm #6718RobLaneParticipantJust 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
October 3, 2013 at 9:37 am #6729AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
October 4, 2013 at 10:10 pm #6747RobLaneParticipantHi 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 workingRegards
Rob
- AuthorPosts
- You must be logged in to reply to this topic.