Skip Navigation

[Resolved] Create a relationship form field filter based on other relationship

This support ticket is created 4 years, 10 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)

Tagged: 

This topic contains 7 replies, has 2 voices.

Last updated by paoloP-11 4 years, 10 months ago.

Assisted by: Shane.

Author
Posts
#1818185

Tell us what you are trying to do?
Hi, I need some help creating a form.

I have 3 custom post types: Taskforces (slug=taskforce), Profiles (slug=profile) and Documents (slug=document)
I have 2 relationship:
taskforce-document (One Taskforce to Many Documents)
taskforce-profile (many to many)

Basically, a WordPress user is a Profile Author and a Document Author.

So, I want to create a form to insert a new document and to do this i need to populate the relationship field taskforce-document only with options available for the profile of the same author.

I tried this:

<div class="form-group">
<label>[cred_i18n name='@taskforce-document.parent-label']Taskforces Documents[/cred_i18n]</label>
[cred_field field='@taskforce-profile.parent' class='form-control' output='bootstrap' select_text='--- not set ---' required='false' author='$current']
</div>

...but it doesn't work.

Maybe I have to create a View (all the Taskforces related to the Profile) to populate the relationship field?

Thanks in advance for help!
Paolo

#1819159

Shane
Supporter

Languages: English (English )

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

Hi Paolo,

Thank you for getting in touch.

Using the author='$current' attribute should only give the posts by the current author. If this is not working then there might be a conflict of some sort.

Can you temporarily disable all the non-toolset plugins and check again to see if the same issue remains ?

If it does then can you provide me with admin access to the so that I can have a look.

Thanks,
Shane

#1822571

Hi Shane,
I don't think it's a concflict problem.
Basically I think it's a problem of Parent/Child relationship but I don't know how to use it.

CONDITION: I am the owner of a PROFILE. PROFILES are connected with TASKFORCES with a relationship field. It's mandatory because a user can only interact with specified Taskforces.
Every USER can also ADD a a custom Post Type Called DOCUMENT. Every DOCUMENT has a MTM relationship with Taskforces.
In the Post form to add a new DOCUMENT, I would like the user to be able to choose only from Taskforces selected by the admin in custom post Type PROFILE (with a relationship field TASKFORCE/PROFILE.
My target is to use in the POST FORM to add a DOCUMENT, the relationship field TASKFORCE/DOCUMENT but FILTERED by the relationship TASKFORCE /PROFILES.

If will be necessary I have to install another test site for privacy reasons and I'll create a a new admin user for you.

Thanks in advance.
Paolo

#1822677

Excuse Me Shane,
In the last ticket there was an error. The relationships are:
taskforce-document (One Taskforce to Many Documents)
taskforce-profile (many to many)

#1824029

Hi Shane,
Fortunately, I solved the problem with a different logical approach. So I no longer need help.
Thanks a lot anyway

#1824981

Shane
Supporter

Languages: English (English )

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

Hi Paolo,

I must apologize for the delay in response as on the weekends the forums are generally closed.

I''m happy to see that you were able to resolve the issue. If you're able to would you mind sharing the solution so that this thread can be used to benefit other users who may be having the same issue ?

Once you've done this you can go ahead and mark this ticket as resolved.

Thanks,
Shane

#1828265

Hi Shane,
basically I got around the problem not assigning the relationship to the document but only to the profile.
Thnaks

#1828267

My issue is resolved now. Thank you!