[SOLVED] Allow Users to have the same name

12 years 11 months ago - 12 years 11 months ago #165344 by clickmo
I'm getting an error when I try to register a user with the same First / Last name as another user. It's saying that a user with that name already exists.

Is there a way to alter the script to allow users to have the same name but require different usernames?

What are the ramifications of doing this?

Please Log in to join the conversation.

12 years 11 months ago #165402 by krileon
Replied by krileon on topic Re: Allow Users to have the same name
Names are not unique; only user_id, username, and email are. Meaning you could have 100 users if you like with the same name. Something else is causing the uniqueness. If you've disabled username field on registration form then this too would be a cause as the username would then be built from their name, which could easily cause conflicts.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

12 years 11 months ago #165420 by clickmo
Replied by clickmo on topic Re: Allow Users to have the same name
That explains why I was not able to find where the check was being made but from what I can tell, the username is required and shown on registration. I have attached an image of the field just to check as well as the error itself.

My exact error is:

42 - Failed to update contact: COM_CONTACT_WARNING_SAME_NAME
Failed to update contact: COM_CONTACT_WARNING_SAME_NAME




Attachments:

Please Log in to join the conversation.

12 years 11 months ago #165432 by krileon
Replied by krileon on topic Re: Allow Users to have the same name
The error you're receiving is not coming from CB. You've some sort of 3rd party extension install trying to generate contact details within Joomlas contact component. That extension is not handling duplicates appropriately.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

12 years 11 months ago - 12 years 11 months ago #165449 by clickmo
Replied by clickmo on topic Re: Allow Users to have the same name
We are creating a secondary registration page for a different user type that requires different fields to be filled out. To do this, we are using the " Create users through API " method. It does check if email and username already exists and cancels out showing an alert displaying the error. For some reason the name does not return an error and simply goes to that screen.

Here is what the function looks like. Maybe you can find an error in the logic.
function registerUser( $FirstName, $LastName, $Email, $Username, $Password, $approve = 0, $confirm = 0, $PostalCode, $var1, $var2, $var3, $Street, $City, $Province, $Phone ) {
	global $_CB_framework, $_CB_database, $ueConfig;
	$postal = $PostalCode;
	include('point.php');
	
	$location = $city . ", " . $town . ", " . $province;
	
	$approval			=	( $approve == 2 ? $ueConfig['reg_admin_approval'] : $approve );
	$confirmation			=	( $confirm == 2 ? $ueConfig['reg_confirmation'] : $confirm 	);
 	$usertype			=	$_CB_framework->getCfg( 'new_usertype' );
 
	$row				=	new moscomprofilerUser( $_CB_database );
	$row->usertype			=	( $usertype ? $usertype : 'Agents' );
	$row->gid			=	$_CB_framework->acl->get_group_id( $row->usertype, 'ARO' );
	$row->sendEmail			=	0;
	$row->registerDate		=	date( 'Y-m-d H:i:s', $_CB_framework->now() );
	$row->name			=	$FirstName . ' ' . $LastName;
	$row->firstname			=	$FirstName;
	$row->lastname			=	$LastName;
	$row->username			=	$Username;
	$row->email			=	$Email;
	$row->password			=	cbHashPassword( $Password );
	$row->cb_var1			=	$var1;
	$row->cb_var2			=	$var2;
	$row->cb_var3			=	$var3;
	$row->cb_area			=	$location;
	$row->cb_streetaddress		=	$Street;
	$row->cb_city			=	$City;
	$row->cb_province		=	$Province;
	$row->ch_phone			=	$Phone;
	$row->cb_postalcode		=	$postal;
	
		
	$user->registeripaddr	=	cbGetIPlist();
	
 
	if ( $approval == 0 ) 	{	$row->approved		=	1;	} 
	else 			{	$row->approved		=	0;	}
	
	if($confirmation == 0) 	{	$row->confirmed		=	1;	} 
	else 			{	$row->confirmed		=	0;	}
 
	if(($row->confirmed == 1) && ($row->approved == 1))	{	$row->block	=	0;	}
	else 							{	$row->block	=	1;	}
 
	if ( $row->store() ) {
		if ( ( $row->confirmed == 0 ) && ( $confirmation != 0 ) ) {
			$row->_setActivationCode();
 
			if ( ! $row->store() ) {
			echo "<SCRIPT LANGUAGE='javascript'>alert('Error"  . $row->getError() . "'); </SCRIPT>";
				return false;
			}
		}
		return true;
	}
 	echo "<SCRIPT LANGUAGE='javascript'> alert('Error"  . $row->getError() . "'); </SCRIPT>";
	return false;
}

Please Log in to join the conversation.

12 years 11 months ago - 12 years 11 months ago #165517 by krileon
Replied by krileon on topic Re: Allow Users to have the same name
I can't assist with your custom registration process; CB supports only its own registration, sorry. Somewhere within your code or whatever is trying to create Joomla contacts for users is causing the problem. Don't believe your registration is erroring, but whatever is trying to create Joomla contact details for a user (within the Contacts component). If I remember correctly this is due to the "contactcreator" system plugin within Joomla, please try disabling it if present.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: clickmo

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.235 seconds

Facebook Twitter LinkedIn