Forums

Username already exists

NJM 17 Sep, 2015
Hi,

I have a question regarding an error "username already exists".

So I have created a registration form. When saved, a part goes to joom_users, and a part is saved to a second table (from chronoforms like "joom_chronoengine_chronoforms_datatable...." ) They are linked with the user_id. When I test it via "test form" and I fill in all the fields, it works perfectly. All valuables are put in the database.

When I place the module in an article and I do the same, I get an error, that the username already exists.
The user is created in the joom_users table, but the user isn't put in the second table.

Any ideas why? Maybe the setup isn't put in the right order?

GreyHead 17 Sep, 2015
Hi noeljm,

It may be a problem with a value of id being picked up from the article id in the page URL. Add a Debugger and see if Id is showing up in the form data. If it is then add a Custom Code action to remove it
<?php
if ( !empty($form->data['id']) {
  unset($form->data['id']);
?>

Bob
NJM 17 Sep, 2015
Hi,
Thanks for answering so soon.

The debugger shows and id from the article, but it also shows the id of the new user, so I'm not user. I've add your <?php ?> but the result remains the same.

I' have a custom code , maybe that errors?
$userid = $form->data['_PLUGINS_']['joomla_registration']['id'];
$form->data['user_id'] = $form->data['_PLUGINS_']['joomla_registration']['id'];
This topic is locked and no more replies can be posted.