Skip Navigation

[Resolved] Split: Displaying Repeatable Group – live site another issues

This support ticket is created 4 years, 9 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
- 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 6 replies, has 2 voices.

Last updated by ceciliaW9184 4 years, 9 months ago.

Assisted by: Minesh.

Author
Posts
#1602161

Hi Minesh;

I implemented your fix onto the live site and it worked great. But had 2 other issues come up.

1) Filter (Screenshot: Query FIlter):
I tried to implement the same search feature onto another view (Search Healthy Volunteers with RFG Locations ID: 18750) but it broke because I had a Query Filter applied to that view. How do i apply a filter to this view?

Here is the broken view.
hidden link

2) Deleting entry in RFG (Screenshot: Delete RFG Data):
Another issue i had was that when I deleted a trial, the repeatable field group location did not delete. I found a way around it by deleting each RFG in the trial before deleting the trial. Is there another way to do this? I may have some trials with 150 RFG locations.

Here is the page with the deleted trials.
hidden link

I updated your user and pw.

access details.

thanks.

#1602205

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

I see you have added the Query filter for the custom field "Healthy Volunteer" but please you need to understand that the field "Healthy Volunteer" is not the part of the repeating field group "List of Additional Locations" as the view is set to query the repeating field group "List of Additional Locations'. You can only add the filters for the fields of repeating field group "List of Additional Locations" as the view is set to query "List of Additional Locations".

I removed the Query filter for the field "Healthy Volunteer" and I can see the results now:
=> hidden link

We can move step by step, can you please confirm the above issue is resolved.

#1602613

Yes I see that you removed the filter.

#1602617

I added the filter within the RFG and it's working. Thank you.

I just had the second question. When i delete a trial, do i have to delete each location in the RFG before I delete the entire trial?

#1602653

Minesh
Supporter

Languages: English (English )

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

The issue when you delete the post, its associated repeating field group entries is not deleted is known to us and already reported in front of our Devs. It will be fixed in near future release but we do not have any ETA on it.

Maybe you should try to use the following workaround that may help you:
- Add the following code to "Custom Code" section of Toolset:

add_action( 'wp_trash_post', 'func_delete_child_related_posts', 10 );
function func_delete_child_related_posts( $post_id ) {

if ( get_post_type( $post_id ) == 'paid-clinical-trial' ){
// get child posts of this parent
                           $children = toolset_get_related_posts(
                                                   $post_id,
                                                  'additional-locations',
                                                 array(
                                                  'query_by_role' => 'parent',
                                                'limit' => 999,
                                              'return' => 'post_id',
                                               'role_to_return' => 'child'
                                                      )
                                             );

                  foreach ($children as $key => $child) {
 
                                         wp_trash_post($child);
                    }
           }
}

More info:
=> https://developer.wordpress.org/reference/hooks/wp_trash_post/

#1602663

Thank you. the code did not work. I will just manually delete for now and hope the fix comes in soon.

#1602665

My issue is resolved now. Thank you!