Buy Now
Sign in

User Registration to a higeher Level

galbur , June 13 at 10:33
G
galbur
Hi
I have a simple Form for users to register to have access to certain aerea. > Joomla User Group "specialaccess"
The registered users can also become a member of the community.
Then they have to fill out a more complex form.
When i use a new form for this, then i got an error message "this email already exist".
So i want to have the possibility that logged in users can go to a new form with the prepopulated fields from their account "specialaccess".
How can i do this?
Thank you Christoph
H
healyhatman
Don't save a new user.
You need a save data action, for the table prefix_user_usergroup_map​
​Data to insert:
user_id:{user:id}
group_id:10 <-- or whatever the id of the group you want to put them in is.
You can use a delete data action to remove them from the old user_usergroup_map if you want.
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman
G
galbur
Hi healyhatman
Thank you very much for helping.
But it's a little bit more complicated than i thought ;-)
I have an extension called easy profiles. This Extension expands the possiblities of ##_users. So i can build some Extrafields.
So when a user register the first time he has to fill out
the joomla minimum (username, name, password, email)
and a few extrafields (Street, Location, Zip-Code) via Easyprofiles.
The two tables are connected via user id.
Now if a registered user is logged in and he wants to become a member, he should come to a new form with some extrafields and prepopulated "Standardfileds" with data from ##_users (joomla standard user table) and ##_jsn_users (Easy Profile Table).
After submit the usergroup should change.
Best regards
Christoph
H
healyhatman
You only need to populate and use those fields if you want the user to change them.
Either way use read data to get the value of the fields and {var:read_data#.model.field} as the field value
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman
G
galbur
Hi
Thank you and sorry. I'm not really a php-crack. But i'm still trying to figure out how it works;-)
But somehting went wrong.
I did the following:
I have two DB Read Actions in the OnLoad Section before HTML Rendering
1. User Joomla Table DB Read
db_read_users.png
2. Easy Profile DB Table Read
db_read_jsn_users.png
Then i used the following as Field Value
read_data.png
And when i test the form it looks like
form.png
Attachments
db_read_users.png
db_read_users.png
(154.11 KiB)
80 Downloads/Views
db_read_jsn_users.png
db_read_jsn_users.png
(153.31 KiB)
83 Downloads/Views
read_data.png
read_data.png
(26.6 KiB)
83 Downloads/Views
form.png
form.png
(24.21 KiB)
82 Downloads/Views
H
healyhatman
Replace the hash with the right number, look at your read_data action for the name. Black label.
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman
G
galbur
Hi
And thank you again!
This Number?
dbread22.png
I used
{var:read_data22.Data_EP.firstname}
as field Value, But with no effect.
Christoph
Attachments
dbread22.png
dbread22.png
(63.75 KiB)
76 Downloads/Views
H
healyhatman
Sorry I just realised you're using the old v5, I thought we were talking about V6. Can't help you with v5 you'll have to look at the instructions.
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman
G
galbur
Ok
Thank you anyway....
Christoph
GreyHead
Hi Christophe,
Please see this FAQ. Once you have the User ID you can look up the corresponding data from the tables.
Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
G
galbur
Hi GreyHead
Thank you for helping and sorry about my delay.
I read the FAQ but i'm still not able to prepopulate the formfields after Login.
It seems the Arrays are working.
But what do i have to put as value in the fields? I tried [name] / {name} / name
Data Array
Array
(
[option] => com_chronoforms5
[chronoform] => TESTFORMULAR_MITGLIED
[Data_JO] => Array
(
[0] => Array
(
[id] => 42
[name] => Testname
[email] => admin@testmail.com
)

)

[Data_EP] => Array
(
[0] => Array
(
[id] => 42
[strasse] => Bakerstreet 156
)

)

)

​Thank you​
​Christoph​
GreyHead
Hi Christoph,
It looks like {Data_JO.0.name} or {Data_EP.0.strasse}
Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
G
galbur
Hi GreyHead
Just great! That seems to work. Thank you very much.
I tried to rebuild the form with chronofroms 6.
Everything works good. I have two DB Read Actions (two tables). And i can use
{var:read_data4.Data_EP.firstname}
to prepopulate the filed values from the Table(s). But where (and how) can i get now the the specific (logged in) user?
Do i need the same Code in chronoforms6?
<?php
$user = \JFactory::getUser();
$form->data['user_id'] = $user->id;
?>
All the best
Christoph
G
galbur
Hi
Another Problem. I have a Chronoform5 Form. Getting the User Id and prepopulate fields works fine.
I have a DB save Action in the OnSubmit Aerea. But if a logged in user makes a change in the form, nothing changes.
Thank you
Christoph
GreyHead
Hi galbur,
For the CFv6 question about User info, please see this FAQ.
For the CFv5 question are you adding the record id to the data to be saved? If not then a new record will be created.
Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much