Forums

Kind of bug in Joomla! Registration action

ciovo 16 Mar, 2012
Hello!

I've a problem with Joomla! Registration action, I'm using version 4 RC3.21.
If a guest want to register, than no problem.
But I created a form to be used only by registered users: they can create child-account (in a different joomla group).
When I create a child-account, the activation does not work with error COM_USERS_ACTIVATION_TOKEN_NOT_FOUND (you've to use a different browser or logout before because Joomla redirects you to the home page if you are already logged-in).
After investigation, I noticed in the database that the new-child-account has the field lastvisitDate filled with the last logout I made instead of '0000-00-00 00:00:00'.
So the validation is not performed because the function activation in components/com_users/models/registration.php searches the token in the request with lastvisitDate equals to $db->getNullDate().
There may be interference also with some other field, because in the new-child-account I see also sendEmail set to 1 if the father-account has 1, even if it should be 0, and params looks the same too...

Thanks for your help!
GreyHead 16 Mar, 2012
Hi ciovo,

Thank you, I've seen some of this reported before. I think that the problem is that the action has not been fully upgraded to Joomla! 2.5 :-( I'll add a link to your post in the bugs list and hopefully it will gt picked up for a future release.

Bob
Max_admin 17 Mar, 2012
Hi ciovo,

You can't register users using the Joomla registration plugin, only guests can use this to "register", if you want to create/update users then use the "Save user" action in the latest version.

Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
ciovo 19 Mar, 2012
Thank you for your help and advices.

Save user action doesn't work exactly as registration (password can't be autogenerated, activation is not customizable).
In my opinion, Joomla! Registration action can be fixed quite easily adding this two lines of code
$user->set('sendEmail', 0);
$user->set('lastvisitDate', JFactory::getDbo()->getNullDate());

after this statement:
$user = clone(JFactory::getUser());

That's what I did and it solved the problem, and I think it should be part of the code or become one option (something like "enable registration by logged-in users").
Iko 31 Mar, 2012
Thanks very much for your posts ciovo! I ran into the same issue, but did not realize the date field could be the culprit. I will try your solution.
Iko 01 Apr, 2012
After a long day, I can report to have it working

First off, the changes need to be made in the chronoform action php scripts, not the joomla ones ;-) They are found in the www\joomla\administrator\components\com_chronoforms\form_actions\... folders.

1. joomla_registration.php - here you can add the code suggested by ciovo


// Get required system objects
$user = clone(JFactory::getUser());
$user->set('sendEmail', 0);
$user->set('lastvisitDate', JFactory::getDbo()->getNullDate());


2. joomla_activation.php - you need to comment out the redirection of logged in users, if you want to activate one user while logged in as a different user


$language->load('com_users');
// If the user is logged in, return them back to the homepage.
//	if ($user->get('id')) {
//		$mainframe->redirect('index.php')
//		return true;
//	}


At the end of the day, I must say it was tedious, but educational ;-)

Thanks again ciovo!
ciovo 11 Apr, 2012
I'm glad my investigation helped you and other people! 8)
polderguy 04 Jun, 2012
Hi,

This is also a bug in the joomla registration plugin for Chronoforms v3.2 (cf_joomla_registration.php).
Both registerDate and lastvisitDate are not set correctly.

To fix this issue replace the following line(s) in cf_joomla_registration.php:

// TODO: Should this be JDate?
$user->set('registerDate', date('Y-m-d H:i:s'));

with:

//Changed setting registerDate according to UTC timezone
$now =& JFactory::getDate();
$user->set('registerDate', $now->toMySQL());

and add the following line(s) directly after the previous lines:

//Added setting lastvisitDate to '0000-00-00 00:00:00'
$user->set('lastvisitDate', JFactory::getDbo()->getNullDate());

For the time zone corrected registerDate and lastvisitDate values to show in Joomla Admin
make sure the value of the '$offset' time zone config setting in configuration.php reflects
the time zone of the server hosting the Joomla website. Also keep in mind Joomla 1.5.x does
NOT take into account Daylight Saving Time (DST). Search for a Joomla plugin to remedy this
flaw in Joomla 1.5.x.

Polderguy
GreyHead 04 Jun, 2012
Hi Polderguy,

Thank you.

Bob
This topic is locked and no more replies can be posted.