Skip Navigation

[Resolved] Select relation in front end form

This thread is resolved. Here is a description of the problem and solution.

Problem:

The issue here is that the user wanted to restrict their relationship forms relationship fields to only the posts that the user created.

Solution:
There is an option on the relationship form fields that allows you to only pull the options for the current user. What this means is that they will only see a list of options that they are the authors for.

Under the filtering option you should be able to set it to get only the current user's posts.

This support ticket is created 2 years, 11 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 5 replies, has 2 voices.

Last updated by alexanderP-4 2 years, 10 months ago.

Assisted by: Shane.

Author
Posts
#2259257

Hi,
I created a CPT for events and one for speakers. Then I created a relationship between speakers and events (many to many). In the backend its no problem to add speakers to an event.
On my website I have a front end form for creating events. But there I can only see the fields from event, but cannot add a speaker. After looking through your help documentation, I found a tutorial. https://toolset.com/course-lesson/front-end-relationship-forms-for-connecting-posts/
With this tutorial, I created a new site with a relationshipform where I can connect events with speakers, which works.
But my problem is, on my website the speakers should be able to create their own events in frontend and should be able to add themselves as speakers. But they should not be able to change the speakers of other events. Is there a way to do this?

#2259273

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Screenshot 2022-01-05 at 9.49.54 AM.png

Hi Alexander,

Thank you for getting in touch.

There is an option on the relationship form fields that allows you to only pull the options for the current user. What this means is that they will only see a list of options that they are the authors for , See Screenshot.

Under the filtering option you should be able to set it to get only the current user's posts.

Thanks,
Shane

#2259297

Thanks Shane. I tried the settings and even I set the filter to current user I'm able in the form to select all, also when I'm not logged in.
You can see yourself:
hidden link

#2259473

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Alexander,

I can indeed see the issue.
Would you mind allowing me to have admin access to the website so that I can have a more detailed look at this for you ?

I've enabled the private fields for your next response.

Thanks,
Shane

#2261033

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Alexander,

It turns out that this is actually working for logged users.

What you need to do is to hide the form for visitors so that they don't have access to it. Additionally you can setup an access group for the page itself so the entire page isn't accessible to visitors.

This can be done by following the instructions in the link below.
https://toolset.com/course-lesson/restricting-access-to-pages/#create-a-post-group-for-pages-restricted-to-logged-in-users

Thanks,
Shane

#2262541

My issue is resolved now. Thank you!