[Plug]ChronoForms is a great form, I wish I had tried it before using some others![/Plug]
I used the example documentation for the Joomla registration form and had it up and running successfully within minutes. Thanks a million for that.
My question is, is there a way to use ChronoForms to create user registrations while logged into Joomla?? The reason for this is we have setup a training site for a client and regional managers need to add the trainees to the system. ChronoForms seemed ideal for that with the Joomla and CB registration plugins.
The hitch I ran into was after typing in the required info and clicking submit, ChronoForms did the same thing as any standard Joomla registration process, it would create the account because I was logged in.
Is there a way to override this behavior so that we can have user logged in and able to create user/trainee accounts so that trainees don't have to do this?
I used the example documentation for the Joomla registration form and had it up and running successfully within minutes. Thanks a million for that.
My question is, is there a way to use ChronoForms to create user registrations while logged into Joomla?? The reason for this is we have setup a training site for a client and regional managers need to add the trainees to the system. ChronoForms seemed ideal for that with the Joomla and CB registration plugins.
The hitch I ran into was after typing in the required info and clicking submit, ChronoForms did the same thing as any standard Joomla registration process, it would create the account because I was logged in.
Is there a way to override this behavior so that we can have user logged in and able to create user/trainee accounts so that trainees don't have to do this?
Hi webjive,
Yes but it will take you some coding.
To add a user to Joomla 'through the back door' you need to edit three tables jos_users, jos_core_acl_aro and jos_core_acl_groups_aro_map - but the last one uses an aro_id that is set in the second one.
If you create the code to write to these three tables then you can add users from anywhere. You'll probably need to use the Joomla Password generator to create passwords but the rest should be straightforward.
Bob
Yes but it will take you some coding.
To add a user to Joomla 'through the back door' you need to edit three tables jos_users, jos_core_acl_aro and jos_core_acl_groups_aro_map - but the last one uses an aro_id that is set in the second one.
If you create the code to write to these three tables then you can add users from anywhere. You'll probably need to use the Joomla Password generator to create passwords but the rest should be straightforward.
Bob
Hi webjive & Bob,
Actually, it's somewhat easier than that. Simply create a new JUser object, along with an array holding the various properties (such as username, name, email, password, password2, gid, and perhaps a few other), bind it to the new user object, and save. Just make sure the 'id' property of the object is empty, which tells joomla we're creating a new user rather than editing an existing one.
Rough skeleton code would look like this:
This way, we don't have to bother with creating salts for the password, setting up proper ARO/ACO's, etc.
/Fredrik
Actually, it's somewhat easier than that. Simply create a new JUser object, along with an array holding the various properties (such as username, name, email, password, password2, gid, and perhaps a few other), bind it to the new user object, and save. Just make sure the 'id' property of the object is empty, which tells joomla we're creating a new user rather than editing an existing one.
Rough skeleton code would look like this:
<? $newuser = new JUser(0);
$newparam = array('username' => 'uname', 'password' => 'thesecret', 'password2' => 'thesecret', 'gid' => 17, ....);
if (!$newuser->bind($newparam))
{
//something went wrong, perhaps inform the user?
} elseif (!$newuser->save())
{
//somethign went wrong, perhaps inform the user?
}
?>
This way, we don't have to bother with creating salts for the password, setting up proper ARO/ACO's, etc.
/Fredrik
Hi Fredrik,
Neat!!
I think I did know that somewhere - just that the last site I did I ended up importing a load of users into the db and had that on my mind.
Bob
Neat!!
I think I did know that somewhere - just that the last site I did I ended up importing a load of users into the db and had that on my mind.
Bob
Well, to put it simple...
The last time I attempted to manually edit the #__users table, I ended up restoring "a few" records (roughly 150-200 users) from backups to get #__users, #__core_* tables back in sync.. Figured it was easier to learn the proper way of doing it the next time.. :p
Also a few comments on my previous post;
You'll find the list of properties in the /libraries/joomla/user/user.php file (contains the JUser class). Also, you don't have to worry 'bout the registeredDate, password_clear, and usertype properties, as these are managed by the JUser class upon save. sendEmail specifies whether the user should receive system emails, and params contains a JParameter object matching the kind of usertype (holds details such as language selection, editor, and other misc stuffs).
/Fredrik
The last time I attempted to manually edit the #__users table, I ended up restoring "a few" records (roughly 150-200 users) from backups to get #__users, #__core_* tables back in sync.. Figured it was easier to learn the proper way of doing it the next time.. :p
Also a few comments on my previous post;
You'll find the list of properties in the /libraries/joomla/user/user.php file (contains the JUser class). Also, you don't have to worry 'bout the registeredDate, password_clear, and usertype properties, as these are managed by the JUser class upon save. sendEmail specifies whether the user should receive system emails, and params contains a JParameter object matching the kind of usertype (holds details such as language selection, editor, and other misc stuffs).
/Fredrik
Hi webjive & Bob,
Actually, it's somewhat easier than that. Simply create a new JUser object, along with an array holding the various properties (such as username, name, email, password, password2, gid, and perhaps a few other), bind it to the new user object, and save. Just make sure the 'id' property of the object is empty, which tells joomla we're creating a new user rather than editing an existing one.
Rough skeleton code would look like this:
<? $newuser = new JUser(0);
$newparam = array('username' => 'uname', 'password' => 'thesecret', 'password2' => 'thesecret', 'gid' => 17, ....);
if (!$newuser->bind($newparam))
{
//something went wrong, perhaps inform the user?
} elseif (!$newuser->save())
{
//somethign went wrong, perhaps inform the user?
}
?>
This way, we don't have to bother with creating salts for the password, setting up proper ARO/ACO's, etc.
/Fredrik
Excellent and thanks! Are you suggesting creating (hack) a new class in /libraries/joomla/user/user.php? Not a problem if so. I'll just need to remember that if I perform a core update to the site to re-add this hack.
No no,
No need to hack any files, that code (modified to suit your form application) would simply go into the "on submit" (before or after email) box, or possibly serverside validation, in your chronoform.
/Fredrik
No need to hack any files, that code (modified to suit your form application) would simply go into the "on submit" (before or after email) box, or possibly serverside validation, in your chronoform.
/Fredrik
This topic is locked and no more replies can be posted.