User Registration to a higeher Level

ga galbur 13 Jun, 2018
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
he healyhatman 13 Jun, 2018
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.
ga galbur 13 Jun, 2018
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
he healyhatman 13 Jun, 2018
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
ga galbur 14 Jun, 2018
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
​
User Registration to a higeher Level image 1
​
​
2. Easy Profile DB Table Read
User Registration to a higeher Level image 2
​
​
​
Then i used the following as Field Value
​
User Registration to a higeher Level image 3
​
And when i test the form it looks like
​
User Registration to a higeher Level image 4
he healyhatman 14 Jun, 2018
Replace the hash with the right number, look at your read_data action for the name. Black label.
ga galbur 14 Jun, 2018
Hi
​
And thank you again!
​
This Number?
User Registration to a higeher Level image 5
​
I used
​
{var:read_data22.Data_EP.firstname}
​
as field Value, But with no effect.
​
Christoph
he healyhatman 14 Jun, 2018
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.
ga galbur 14 Jun, 2018
Ok
​
Thank you anyway....
​
Christoph
Gr GreyHead 14 Jun, 2018
Hi Christophe,
​
Please see this FAQ. Once you have the User ID you can look up the corresponding data from the tables.
​
Bob
ga galbur 28 Jun, 2018
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
Gr GreyHead 28 Jun, 2018
Hi Christoph,
​
It looks like {Data_JO.0.name} or {Data_EP.0.strasse}
​
Bob
ga galbur 28 Jun, 2018
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
ga galbur 29 Jun, 2018
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
Gr GreyHead 29 Jun, 2018
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
This topic is locked and no more replies can be posted.