Joomla Registration and duplicate email addresses

nf nfg 30 Jan, 2009
Hi there,

Here's a question that may not be me overlooking some well documented fact.

Using j 1.5.8 and Chrono Contact 3.0 STABLE

I've set up the Joomla Registration plugin in a form. All works well except that when I try to register with a duplicated username or email I get no useful error.

For example in a form without a redirect url after posting if I register a second username 'nfg' I get 'you are not allowed to access this url' and no emails are sent.

if I register with a unique username but a duplicate email nfg@somewhere I get a blank page and no emails are sent.

If I include a redirect url I get the url I enter.

I'm not sure how to capture the error here. Joomla must be returning something useful so does anyone have a suggestion how to grab it?

Is this a bug or am I missing some important fact?

I'm looking at line 411 in cf_joomla_registration.php which says:

		// If there was an error with registration, set the message and display form

		if ( !$user->save() )

		{

			JError::raiseWarning('', JText::_( $user->getError()));

			return false;

		}


Thanks for any help

NFG
Max_admin Max_admin 30 Jan, 2009
Hi NFG,

Joomla should display some error as you see in this code piece but it looks like your template is not 100% ready for J1.5 and so you don't get the warning, some line of code need to be added to your template, I can't remember it now 😑 but it should be in the js_purity comes with joomla 1.5 by default!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
nf nfg 30 Jan, 2009
This makes sense.

I took the registration override from Beez and modified it. I'll look around and post back what I find.
nf nfg 01 Feb, 2009
Thank you both, Max and Bob for your help once again.

Your suggestion worked exactly as designed. Unfortunately I think that Joomla's system for doing this is a little odd and can result in errors being placed on a page in a way that is seemingly out of context, like putting an error on a page that thanks you for registering.

So what I did was just verify everything again myself using the form's server side verification. It's redundant but it works.

I briefly searched for a way to get access the array of errors in an effort to make a better-behaved replacement for <jdoc:include type="message" /> but decided that this was the quickest method. It's uncomplicated and it provides feedback for all the things that Joomla will kick a registration for: Matching username or email, and non-matching password.

Posted here in case its of any use to anyone.



global $mainframe; 

$db =& JFactory::getDBO();


	// verify name
	
	$query = "SELECT username FROM jos_users WHERE username = '" . JRequest::getVar('username') . "';";
			
	$db->setQuery($query);
	
	$db->query();
	
	if ( $db->getNumRows() ) 
	
	
	return 'That username is already in use. Please try another.'; 


	// verify email
	
	$query = "SELECT email FROM jos_users WHERE email = '" . JRequest::getVar('email')  . "';";
			
	$db->setQuery($query);
	
	$db->query();
	
	if ( $db->getNumRows() ) 
	
	
	return 'Someone has already registered using that email. Please try another.'; 
	
	
	// verify password
	
	
	if ( JRequest::getVar('password') != JRequest::getVar('password2') ) 
	
	
	return 'Sorry, your passwords do not match, please try again!'; 



Now I just want to repopulate the fields.
Max_admin Max_admin 01 Feb, 2009
Hi nfg,

good approach, thanks for sharing the code!😉

try to enable "try to republish" option under the "anti spam" tab ?

Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.