Skip Navigation

[Resolved] custom searches

This support ticket is created 7 years, 7 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 4 replies, has 2 voices.

Last updated by Beda 7 years, 7 months ago.

Assisted by: Beda.

Author
Posts
#434819

This is what I am trying to do but cant quite work it out.
I have a post type called member, with a custom field called Associates which currenly is a single line accepting multiple values.

1) Ideally when someone adds a Member via the front end, and they add an associate they would get a drop down or type in a few letters and if the name already exists as a member they can select that person as an associate which would link then to that profile. (presumably this would be a search on the title) If that person doesnt exist then they simply add the name and appears on Member as an unliked associate.

2)If at a later stage the unlinked assicate is added as a member then it would automatically show as a link where before it hadnt been

Is this possible?

#434943

This is not possible natively without an effort of creating a Custom Logic.

You can add a Custom Search created by Views to your CRED Form.
This View will query your Members and let the User search through them.
It can be a Search as a text Field using the "Text Search" Filter in the View

It would present the User a list of existing Memebers (all of them on first load) and after searching, the refined search results.

It can not be used to automatically populate a CRED field. For this you would need a Custom Code that populates a CRED Field with JSON Code as example (a CRED generic Field).

To automatically link the Associate Field to a existing (or not) member, you first need to know how you want to link existing Members.
How do you plan to do that?
Will you use the exact title of the Member Post to link it?
How will you ensure that the User enters the exact title /Slug as wished?

I think it would be simpler to achieve this with a parent/child relation, where associates are childs of members and you use a Custom Code to check if the Associate already exists.
If so, you would throw a Custom error, and if not, you would pulbish it.
https://toolset.com/documentation/user-guides/creating-post-type-relationships/
https://toolset.com/documentation/user-guides/cred-forms-for-child-content/

This could be acheived with the CRED validation API:
https://toolset.com/documentation/user-guides/cred-api/#cfv

#434977

Thanks Ill go through this

#434980

Hi
Can my custom post Member be both a parent and a child - ie have a many to many relationship with other Members.

In my example a single post - Member is both a stand alonme Member as well as potentially being an Associate of another Member or Members.

This is just the example scenario I am working on to test, Ultimately I want to build a network of Family Connections so

A member will be a stand alone piice of content with Fields for say Father , Mother, Brother and Sister. Any other Member could one of these family members and vice versa. The idea is to be able to link these when adding or editing a Member - based on either Post Title or First Name and Last Name.

I cant vouch for spelling mistakes etc hence was also exploiring how to present a search
https://toolset.com/forums/topic/automatically-populate/#post-434978

Thanks once again

#435111

Any Post type can be both, parent and child, but obviously not to the SAME Post type.

You can not have the Same Post type to be parent or child to another post in the same type.

This would be possible only with the native WordPress Parent/Child relation that is usually used in WordPress Pages.
This can be enabled for Custom Post Types in the Post Types Settings Screen under Toolset > Post Types.
It's elaborated here:
https://toolset.com/documentation/user-guides/create-a-custom-post-type/ > Even More Advanced Custom Post Types Settings

I understand you have this process:

1. Member gets created (no relation yet)

2. Another member gets created (no relation yet)

3. You see that member one is let's say mother of member 2, you want to connect them

Best would be to use a taxonomy or a Custom Field, or, a Parent Post Type, or, a Parent Post (the WordPress way) to connect those Members.

You would create a taxonomy, or post, or post in a post type, that is as example "Family XY"
And that would connect all the Member posts.

This an hardly be done automatically because there might be many similar (even equal) Family names.

So here I suggest a Taxonomy. When your user creates a Member he / she sees a Taxonomy Picker with all already created Families.
They could pick a family from there, or even create a new family (term) all from within CRED Forms.

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