In a contact form, I want to check if the user exists before I register the user in the joomla user database. I use the email as username (and password, to simplify).
The event switcher block works fine, so does the user registration block when used separately. However, as soon as I use both blocks, the user registration hangs in an endless loop. I have tried putting the user registration into the "success" part of the event switcher or as independent subsequent block using show stoppers (image annexed), no difference. As soon as I take out the event switcher, the user registration works fine. If I delete the user registration, the event switcher works fine (I check using messages).
Event Switcher Code (nothing special, cloned from your FAQ, works fine, I have no questions here)
If I replace the user registration block by messages, everything works fine. It seems that the combination of both blocks creates an issue I am not aware of. (If I replace the above code by a simple return "success", the same issue happens. It is not the code, but the presence of the event switcher that seems to cause trouble).
The event switcher block works fine, so does the user registration block when used separately. However, as soon as I use both blocks, the user registration hangs in an endless loop. I have tried putting the user registration into the "success" part of the event switcher or as independent subsequent block using show stoppers (image annexed), no difference. As soon as I take out the event switcher, the user registration works fine. If I delete the user registration, the event switcher works fine (I check using messages).
Event Switcher Code (nothing special, cloned from your FAQ, works fine, I have no questions here)
<?php
return "success";
$db =& JFactory::getDBO();
$query = "
SELECT COUNT(*)
FROM `med_users`
WHERE `email` = '{$form->data['email']}' ;
";
$db->setQuery($query);
$count = $db->loadResult();
if ( $count ) {
$form->validation_errors['email'] = "Email is already registered, don't need to register user again.";
return "fail";
}
return "success";
?>
If I replace the user registration block by messages, everything works fine. It seems that the combination of both blocks creates an issue I am not aware of. (If I replace the above code by a simple return "success", the same issue happens. It is not the code, but the presence of the event switcher that seems to cause trouble).
Hi mackilroy,
The Event Switcher code you have here has return 'success'; as the first line so will only ever return 'success'. I'm not sure what happens after that though. Do you have a ReDirect after the Joomla! Registration that might be re-loading or re-submitting the form?
Bob
The Event Switcher code you have here has return 'success'; as the first line so will only ever return 'success'. I'm not sure what happens after that though. Do you have a ReDirect after the Joomla! Registration that might be re-loading or re-submitting the form?
Bob
Dear GreyHead,
thanks for looking into this.
This return "success" was from my testing around, just to see if the data base check makes any difference. Sorry for that, please ignore this return, obviously I tested without the return in the first line. There is no ReDirect after the registration block but the usual thank you message.
thanks for looking into this.
This return "success" was from my testing around, just to see if the data base check makes any difference. Sorry for that, please ignore this return, obviously I tested without the return in the first line. There is no ReDirect after the registration block but the usual thank you message.
Dear GreyHead,
another info: I have cloned the module and replaced the user registration by a custom DB table (DB Save) using a new data base table I created for the module (using chronoforms table creation). This has worked fine (after taking out the early return statement, of course), the 'email exists check' - event switcher does its job and DB save works fine.
yours
Roland
another info: I have cloned the module and replaced the user registration by a custom DB table (DB Save) using a new data base table I created for the module (using chronoforms table creation). This has worked fine (after taking out the early return statement, of course), the 'email exists check' - event switcher does its job and DB save works fine.
yours
Roland
You have the problem on both "success" and "fail" events ? or only on fail ? you have a "show stopper" on fail and that will halt any processing!
Hi mackilroy,
Someone else reported a similar problem when the Site didn't have New User Registration enabled?
Bob
Someone else reported a similar problem when the Site didn't have New User Registration enabled?
Bob
Hi Greyhead,
the new user registration is enabled. That's why the user registration works fine if there is no event switcher before it.
I will give up on this funcionality and use a user defined DB table instead of the user registration module. With such a custom table, there is no problem. Something seems to be wrong with the combination of event switcher and user registration. Maybe other users are confronted with something similar.
Thanks
Roland
the new user registration is enabled. That's why the user registration works fine if there is no event switcher before it.
I will give up on this funcionality and use a user defined DB table instead of the user registration module. With such a custom table, there is no problem. Something seems to be wrong with the combination of event switcher and user registration. Maybe other users are confronted with something similar.
Thanks
Roland
This topic is locked and no more replies can be posted.