Skip Navigation

[Resolved] Register family members in the users account

This support ticket is created 5 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+01:00)

This topic contains 7 replies, has 2 voices.

Last updated by Nigel 5 years, 8 months ago.

Assisted by: Nigel.

Author
Posts
#1074817

Hi Nigel,
I'am writing you in refference to ticket https://toolset.com/forums/topic/split-custom-display-in-forms/#post-921289
I don't know if it is possible. In the other thread (https://toolset.com/forums/topic/split-custom-display-in-forms/#post-921289) I wrote you, that the user should have the following abilities:
- Register with his data (first name, last name, e-mail, address etc.)
- Ability to see a list of all the events for which he registered for (from the form https://toolset.com/forums/topic/display-a-view-or-template/#post-920266)
- Ability to autofill the form for an event ( for example https://toolset.com/forums/topic/display-a-view-or-template/#post-920266) with his address-data
- Ability to change/edit the his address data
- Ability to delete events for which he is registered
- Automatically change the password for the user (if he forgot his password or wants to change it).

Now there is an additional wish from the customer. When a user register for his account with E-Mail, password etc. he also should have the ability to enter additional family members in his account (for example the father registers an account for him and he should be able to enter the data for his family members like daughter, son, wife etc.). He than should see a list of all his family members he entered and should have the ability if he wants to register for a single event in the registration form at the bottom of the page (hidden link) that he can take over the data from his account (his own data or the data of one of his family members) into the form (hidden link) . Is this possible, that the user can choose von of the persons from his account and take the data over into the registration form for an event?
Bay the way, I see an error message "Permission denied" an can not see the registration form for a single event, if I'am not logged in into the WordPress backend. I don't use the Access PLugin yet. So do you know, why this error appears?

Thanks
Thorsten

#1076135

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi Thorsten

You'll have to forgive me, as I work on many different issues I don't remember all of the details for each of them.

Is the intention that other family members are added as actual users (with their own accounts)? Or simply that one user can add details of the names and contact details for other related people, and such details can be submitted in the form, i.e. that one family member can register on behalf of another, using the other's details?

This may involve quite a lot of changes to your existing forms.

You can't create relationships between users directly (to link members of a family), you have to simulate it by creating a profile post for each user, and then you can connect the profiles. It is described in this documentation and may be what's required for your issue: https://toolset.com/documentation/user-guides/how-to-create-custom-searches-and-relationships-for-users/

But then you may need to change your previous work to use the profile posts rather than the user fields.

Regarding your last comment, it sounds as if you have activated Access, even if you have not started using it, because Access automatically hides Toolset Forms from guest users unless you explicitly make them visible.

#1076211

Hi Nigel,
no problem. I can understand, that you can not remeber the details, as we are all humans and thas normal for all of us. ?
Yes, the intention only is, that the actual user can add details of the name and address of his family members and not to create as extra users. So I have to use the the approach you described above (https://toolset.com/documentation/user-guides/how-to-create-custom-searches-and-relationships-for-users/)?
The Create-Account process is optional. People who want to registewr for an event and do not want to create an account should register for an event without having to register and people who want to create an account should have the ability to take over their data (name, address etc.) from themself and their family members into that event register form.
Thanks
Thorsten

#1076382

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

It's not something you can readily do.

The form on this page: hidden link

You want the fields for surname, first name, date of birth etc. to be auto-filled, yes?

When you add fields to a Form you can include the value attribute to provide an initial default value.

If you had, say, user fields with the relevant data then you could use these types fields as the default values (when editing the form add a value="" attribute to a field and then use the Fields and Views button to insert a shortcode for the corresponding user field for the current user).

But you can only supply one default value, such as a user field for the current user.

It would be possible to add an id attribute to the shortcode which produces the user field to output the field value from a different user, not the current user.

So, in theory, if all the family members had user accounts you could populate the form with default values that came from different users.

But that would have to be determined at the time the form was generated (by—somehow—setting the id of the desired user).

What is not possible is for that form to be shown on the screen and *then* the user selecting another user (family member) whose details should be used to populate the form, by the time the form is rendered it is too late to change default values.

Now, I've been describing doing this with different users.

But you say you want to add family members without creating new users.

You could add a custom post type for the family members with fields for each, and you could then set up the form to populate the value attributes with fields from one of the child posts which you would have to set at the point the form was rendered. (The user, e.g. the father, would have to add one of the same child posts for themselves so that it would be possible to pre-populate the form with their field values.)

I'm not going in to too much detail here because I suspect this is not what you want, having to know whose details should be used before the form is even rendered.

#1077320

Yes, my intention was, that the fields of this form are autofilled with the data of the person:
- First name
- Last name
- Street / ZIP / Town
- Phone Number
- E-Mail
- Age at the beginning of the event
- Birthdate

My problem at the moment is, how can I establish a connection/relationship between the persons that the the user created in the account (for example the family father with his data, his wife or children) and the events?
I also was thinkling about another solution, but I don't know if this possible. Maybe it's better to seperate the event form (hidden link) which is users, who don't have an account from the ones who have an account. Instead of autofill the option the form it's maybe better, that there is a list in the account of all registered persons (father, mother, children) persons with the data from above (inluding the person who created the account -> for example the father or his wife) and at the right of the data of each person there is a dropdown with the events and at the right of the dropdown there is a Button called "Register for this event" and then the user can register for an event and teh team member will receive an E-Mail with all neccessary data. Is this possible? Or maybe you have a better solution what can easily be done?
Thanks
Thorsten

#1077543

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Your last option sounds feasible.

You could create a "contact-details" post type, and—let's say—the father adds contact detail posts for each of his family. He would be the author of the contact-details posts.

Then you create a View to list contact-detail posts and add a Query Filter for the post author so that you are showing the father their contact detail posts (one for each family member, including himself), and you add a link to a Form to register for an event. The link should append a URL parameter with the post id of the contact-detail post (e.g. you add something like ?contact-id=[wpv-post-id] to the link).

Then in the form you can refer to the chosen contact-detail post to set default values using the urlparam attribute.

So a field for the email address in the form where we have passed a contact-id URL parameter might look like:

[cred_field field='contact-email' value='' urlparam='contact-id' output='bootstrap']

See https://toolset.com/documentation/user-guides/cred-shortcodes/#cred_field

Have a go at implementing a test of that to see how it works so you can understand whether it would suit your case.

(I have a few days off coming up so you might want to close this and then ask specific questions in new threads which my colleagues will be able to help you with.)

#1077679

Ok, I understood the concept. 🙂
Only one question left for me. Where is the reference/relationship to the corresponding event in the URL that redirects to the form to register for an event?

Thanks
Thorsten

#1078356

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi Thorsten

If I recall correctly you have an event post type and then a child post type to register for the event (created by submitting a Form).

If you are displaying the form on a different page and linking to it then setting the parent post to which the post created by the form belongs is described in the documentation here: https://toolset.com/documentation/post-relationships/selecting-parent-posts-using-forms-create-child-items/

On the parent page you create a link to the page that contains the child post form.

You insert the link with the "Create Child Post Link" button inside the Toolset Forms button.

If you use that and try it you will see that the link generated links to the page containing the form and adds a URL parameter which has the ID of the post you are linking from (the parent), e.g. site.com/page-with-form/?parent_event_id=41

Now, there is no way when adding that link using the GUI to add a second URL parameter such as a contact-id parameter as I was describing above.

No problem, you can just create the link manually, something like

<a href="<em><u>hidden link</u></em>">Register for event</a>

Except, writing that out I see that I'm using wpv-post-id twice.

Because in my previous reply we talked about linking to the registration form from the list of family members, whereas I just described linking to the form from the event itself (which would be typical).

I think what you have instead is an event post, which includes a View listing the contacts (family members), and the links to register come from that View, in which case the View needs to know which event it is being shown on to be able to generate the parent event URL parameter.

This is starting to get somewhat unwieldy, but you can set the eventid as an attribute when you insert the View like so:

[wpv-view name="contacts" eventid="[wpv-post-id]"]

Then inside the View you can refer to the eventid using the wpv-attribute shortcode (https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-attribute), so you would generate the link to the form something like:

<a href="<em><u>hidden link</u></em> name='eventid']&contact-id=[wpv-post-id]">Register for event</a>

You will probably need to read through that a few times, but hopefully it will make sense.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.