Title: Compatible with Allow Multiple Accounts plugin?
Last modified: August 30, 2016

---

# Compatible with Allow Multiple Accounts plugin?

 *  Resolved [JeffFixM](https://wordpress.org/support/users/jefffixm/)
 * (@jefffixm)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/compatible-with-allow-multiple-accounts-plugin/)
 * Hi,
 * I need a registration solution which allows multiple accounts to use the same
   e-mail address. I tried to do this using Profile Builder (with a default value
   in the email field) and the Allow Multiple Accounts plugin, but I still get the“
   this email address is already in use” error message.
 * Do you know of a plugin/code that will accomplish this with Profile Builder? 
   Really want to use your plugin for this.
 * Thanks!
 * [https://wordpress.org/plugins/profile-builder/](https://wordpress.org/plugins/profile-builder/)

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

 *  Thread Starter [JeffFixM](https://wordpress.org/support/users/jefffixm/)
 * (@jefffixm)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/compatible-with-allow-multiple-accounts-plugin/#post-6742970)
 * By the way, I understand the importance of the e-mail address for security, but
   in this case the website is not publicly accessible.
 *  Plugin Author [Cristian Antohe](https://wordpress.org/support/users/sareiodata/)
 * (@sareiodata)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/compatible-with-allow-multiple-accounts-plugin/#post-6743216)
 * Hi Jeff,
 * Theoretically you could write a piece of code to make the two compatible, however,
   for it to work correctly it’s just to much work for something that’s an edge 
   case.
 * You can use this code to register users via out register form with the same email
   address, however, I do not know how this impacts the password reset or edit profile
   forms:
 *     ```
       /*
        * Remove the email validation for email already exists.
        */
       function wppb_allow_multiple_accounts_email( $message, $field, $request_data, $form_location ){
       	global $wpdb;
   
       	if ( ( isset( $request_data['email'] ) && ( trim( $request_data['email'] ) == '' ) ) && ( $field['required'] == 'Yes' ) )
       		return wppb_required_field_error($field["field-title"]);
   
       	if ( isset( $request_data['email'] ) && !is_email( trim( $request_data['email'] ) ) ){
       		return __( 'The email you entered is not a valid email address.', 'profilebuilder' );
       	}
   
       	if ( empty( $request_data['email'] ) ) {
       		return __( 'You must enter a valid email address.', 'profilebuilder' );
       	}
   
       	$wppb_generalSettings = get_option( 'wppb_general_settings' );
       	if ( is_multisite() || ( !is_multisite() && ( isset( $wppb_generalSettings['emailConfirmation'] ) && ( $wppb_generalSettings['emailConfirmation'] == 'yes' ) ) ) ){
       		$user_signup = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM ".$wpdb->base_prefix."signups WHERE user_email = %s", $request_data['email'] ) );
   
       		if ( !empty( $user_signup ) ){
       			if ( $form_location == 'register' ){
       				return __( 'This email is already reserved to be used soon.', 'profilebuilder' ) .'<br/>'. __( 'Please try a different one!', 'profilebuilder' );
       			}
       			else if ( $form_location == 'edit_profile' ){
       				$current_user = wp_get_current_user();
   
       				if( ! current_user_can( 'edit_users' ) ) {
       					if ( $current_user->user_email != $request_data['email'] )
       						return __( 'This email is already reserved to be used soon.', 'profilebuilder' ) .'<br/>'. __( 'Please try a different one!', 'profilebuilder' );
       				}
       			}
       		}
       	}
   
       	$users = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->users} WHERE user_email = %s", $request_data['email'] ) );
       	if ( !empty( $users ) ){
       		if ( $form_location == 'register' ){
       			//return __( 'This email is already in use.', 'profilebuilder' ) .'<br/>'. __( 'Please try a different one!', 'profilebuilder' );
       			//var_dump( $message );
       			return '';
       		}
   
       		if ( $form_location == 'edit_profile' ){
       			if( isset( $_GET['edit_user'] ) && ! empty( $_GET['edit_user'] ) )
       				$current_user_id = $_GET['edit_user'];
       			else{
       				$current_user = wp_get_current_user();
       				$current_user_id = $current_user->ID;
       			}
       			foreach ( $users as $user )
       				if ( $user->ID != $current_user_id )
       					return __( 'This email is already in use.', 'profilebuilder' ) .'<br/>'. __( 'Please try a different one!', 'profilebuilder' );
       		}
       	}
   
       	return $message;
       }
       add_filter( 'wppb_check_form_field_default-e-mail', 'wppb_allow_multiple_accounts_email', 20, 4 );
   
       add_action('plugins_loaded', 'wppb_remove_email_validation');
       function wppb_remove_email_validation(){
       	remove_filter( 'wppb_check_form_field_default-e-mail', 'wppb_check_email_value', 10, 4 );
       }
       ```
   
 *  Plugin Author [Cristian Antohe](https://wordpress.org/support/users/sareiodata/)
 * (@sareiodata)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/compatible-with-allow-multiple-accounts-plugin/#post-6743217)
 * I forgot to mention, that code needs to be placed in a custom plugin or in your
   theme’s functions.php
 *  Thread Starter [JeffFixM](https://wordpress.org/support/users/jefffixm/)
 * (@jefffixm)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/compatible-with-allow-multiple-accounts-plugin/#post-6743219)
 * Hi Cristian,
 * Thanks for your reply. I put your code in my child theme’s function.php file,
   but I get a 500 error message, so something’s not right. Any ideas?
 * Best regards,
    Jeff
 *  Plugin Author [Cristian Antohe](https://wordpress.org/support/users/sareiodata/)
 * (@sareiodata)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/compatible-with-allow-multiple-accounts-plugin/#post-6743230)
 * Do you have a proper <?php opening and ending ?>
 *  Thread Starter [JeffFixM](https://wordpress.org/support/users/jefffixm/)
 * (@jefffixm)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/compatible-with-allow-multiple-accounts-plugin/#post-6743240)
 * Yes, I do.
 * I could pm you the log in credentials?
 *  Plugin Author [Cristian Antohe](https://wordpress.org/support/users/sareiodata/)
 * (@sareiodata)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/compatible-with-allow-multiple-accounts-plugin/#post-6743241)
 * better yet you should just send me the entire functions.php file. Just archive
   it and send a dropbox link or paste everything in it here [http://pastebin.com/](http://pastebin.com/)
 *  Thread Starter [JeffFixM](https://wordpress.org/support/users/jefffixm/)
 * (@jefffixm)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/compatible-with-allow-multiple-accounts-plugin/#post-6743242)
 * It’s basically your code. I haven’t got anything else in there at the moment.
 * [http://pastebin.com/j5TZnWUq](http://pastebin.com/j5TZnWUq)
 *  Thread Starter [JeffFixM](https://wordpress.org/support/users/jefffixm/)
 * (@jefffixm)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/compatible-with-allow-multiple-accounts-plugin/#post-6743243)
 * Update!
 * I made a new function.php file with your code and it works perfectly! I must’ve
   made a mistake somewhere.
 * Thanks for your help!
 * Best regards,
    Jeff
 *  Plugin Author [Cristian Antohe](https://wordpress.org/support/users/sareiodata/)
 * (@sareiodata)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/compatible-with-allow-multiple-accounts-plugin/#post-6743244)
 * Glad that worked out for you!
 * Also, I was wondering, once you will have started using PB for a while, will 
   it be too much to ask for you to leave a review of PB on [http://wordpress.org/support/view/plugin-reviews/profile-builder](http://wordpress.org/support/view/plugin-reviews/profile-builder)?
   One or two sentences will do it and it may help us to reach more people as well
   as get feedback from existing users.
 *  Thread Starter [JeffFixM](https://wordpress.org/support/users/jefffixm/)
 * (@jefffixm)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/compatible-with-allow-multiple-accounts-plugin/#post-6743245)
 * Oh wait, too fast.
 * I can add users in the front end without e-mail address, but the newly registrated
   users don’t show up in de user list in wp-admin.
 *  Thread Starter [JeffFixM](https://wordpress.org/support/users/jefffixm/)
 * (@jefffixm)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/compatible-with-allow-multiple-accounts-plugin/#post-6743246)
 * I get the user created message, but user is not really created. I checked the
   db and no new user is added.
 *  Plugin Author [Cristian Antohe](https://wordpress.org/support/users/sareiodata/)
 * (@sareiodata)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/compatible-with-allow-multiple-accounts-plugin/#post-6743247)
 * Make sure Allow Multiple Accounts is active and configured. The two plugins should
   now work.
 *  Plugin Author [Cristian Antohe](https://wordpress.org/support/users/sareiodata/)
 * (@sareiodata)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/compatible-with-allow-multiple-accounts-plugin/#post-6743248)
 * Basically you need to have the email address added to Allow Multiple Accounts
   settings or enable it for all emails.
 *  Thread Starter [JeffFixM](https://wordpress.org/support/users/jefffixm/)
 * (@jefffixm)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/compatible-with-allow-multiple-accounts-plugin/#post-6743249)
 * Works like a charm!
 * I thought your solution worked independantly of allow multiple accounts, but 
   I get it now. Activated the Allow Multiple Accounts plugin and works great.
 * BR
    Jeff

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

The topic ‘Compatible with Allow Multiple Accounts plugin?’ is closed to new replies.

 * ![](https://ps.w.org/profile-builder/assets/icon-256x256.png?rev=2961144)
 * [User Profile Builder - Beautiful User Registration Forms, User Profiles & User Role Editor](https://wordpress.org/plugins/profile-builder/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/profile-builder/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/profile-builder/)
 * [Active Topics](https://wordpress.org/support/plugin/profile-builder/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/profile-builder/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/profile-builder/reviews/)

## Tags

 * [multiple accounts](https://wordpress.org/support/topic-tag/multiple-accounts/)

 * 15 replies
 * 2 participants
 * Last reply from: [JeffFixM](https://wordpress.org/support/users/jefffixm/)
 * Last activity: [10 years, 6 months ago](https://wordpress.org/support/topic/compatible-with-allow-multiple-accounts-plugin/#post-6743249)
 * Status: resolved