Skip Navigation

[Assigned] Two relationship forms interfering -2

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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 9 replies, has 1 voice.

Last updated by nicolaS-3 8 hours, 12 minutes ago.

Assisted by: Minesh.

Author
Posts
#2848356

---------------- replacing the previous ticket, please open private reply here thanks
Hi all,
I have two different relationship forms on the same page (see picture). The first one has a parent selection, the second doesn't need it. The first one works perfectly, the second one would also, but the parent selection dropbox of the first one appears also on the other form preventing it to work because the selection is mandatory. If I delete the dropdown in the console also the second form works fine. I think this happens because Toolset generates the forms with the same code and I cannot hide the second with CSS because also the first one disappears. Is there anything I can do to work around this issue ? thanks
Regards
Nicola

#2848359

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

I have set the next reply to private which means only you and I have access to it.

#2848370

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

If you check the Events content template:
=> hidden link

I've added shortcode block at the top of the content template and added the following two links to it:

<a href="/event-apply-as-band/?event_id=[wpv-post-id]">  <h1>  Apply as Band </h1> </a> 
== 
<a href="/event-apply-as-musician/?event_id=[wpv-post-id]">  <h1>  Apply as Musician </h1> </a> 

We are linking the two pages you created with the current event Id.

Then, with the two pages you created:
- Apply as Band: hidden link
At top of the page I've added shortcode block and added the following shortcode to it to display the relationship form:

 [cred-relationship-form form='event-application-for-bands' parent_item="[wpv-search-term param='event_id']"] 

- Apply as Musician: hidden link
At top of the page I've added shortcode block and added the following shortcode to it to display the relationship form:

 [cred-relationship-form form='event-applications-for-profiles' parent_item="[wpv-search-term param='event_id']"]

Now, when you check on frotnend:
- hidden link

At top of the above event post you will see two links: Apply as Band and Apply as Mucician

once you click on any of the link it will redirected on the related page you will click the link on and it will also set the parent event automatically.

You can move the form where you want to display to whatever section you want.

#2848377

Hi Minesh,
I appreciate your effort but the original problem still appears also with this page structure: when you apply as a musician the form doesn't work because there is a dropdown (select a band) that doesn't belong to that form and it shouldn't show !! it looks like that dropdown appears independently if the two forms are on the same page or not. That form is about the event-profile relationship, not event-band. This means that there is an issue (a bug ?) I GUESS related to the fact that both are relationships where the event is parent (hidden in both forms). The issue/bug is not related to the forms, but to something else.

#2848379

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you pleaes check now: hidden link

I see now profile filed. I just reset the relationship form:
- hidden link

You can remove/hide the fields as required.

#2848382

ok, it seems that we are getting better BUT there is no need for a dropdown here, the current user profile must be automatically selected (if there is no profile yet this form is not shown and i've placed a conditional on the page showing a message inviting the user to create one). Of course surrent user should not be allowed to select someone else's profile.
Actually we don't even need a form here, parent and chid can be automatic, is there any other way than a form to do so ?

#2848449

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

ok, it seems that we are getting better BUT there is no need for a dropdown here, the current user profile must be automatically selected (if there is no profile yet this form is not shown and i've placed a conditional on the page showing a message inviting the user to create one). Of course surrent user should not be allowed to select someone else's profile.

Actually we don't even need a form here, parent and chid can be automatic, is there any other way than a form to do so ?
===>
In order to connect the post we will require relationship form.

What profile post you want to see that should be automatically selected? Is it the case that you have a profile post available per user and based on the current loggedin user we need to find the profile post and that should be automatically selected?

#2848469

Exactly. The parent (event) is the current one shown in the content template, the child is the profile of the current user (current user = author of the profili custom post). Each user can have just one profile. The form just need to show a button to create the relationship. You don't need to test if a profile exists for the current user, I do this before showing the form with a conditional. If it exists I show the form, if not I show a message "please create a profile".

#2848487

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I've created the following view that will return the ID of the profile post belongs to the current loggedin user.
- hidden link

With the page event apply as musician:
- hidden link

I've added the form as given under:

[cred-relationship-form form='event-applications-for-profiles' parent_item="[wpv-search-term param='event_id']" child_item="[wpv-view name='get-current-loggedin-profilo-id']"]

As you may noticed, we are pssing the parent and child item IDs so it will be selected respectively with the select dropdown.

Now, logged in as user "barbie1234" in different browser and check the following post:
- hidden link

I can see both parent and child dropdown are selected and now you can use and modify this form as per your requirement further.

#2848623

Hi Minesh,
passing the paramenter the forms now look good, but no posts are created. The event-profile form seems to be working (I get a "done" message from the form) but the relation is not created. I've also tested the other form event-band, the form looks good but no relationship is created. This one form seems to do nothing at all. Please check, thanks