Skip Navigation

[Resolved] Query the member list from a list of coupons

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 1 reply, has 2 voices.

Last updated by Minesh 1 year, 8 months ago.

Assisted by: Minesh.

Author
Posts
#2575853

Dear Sir/Madam,

I have a relationship custom posts Members [0 .. 1] << Coupons [*] and Trainers [0 .. 1] << Coupons [*], I can able to query a list of coupons that belong to a specific trainer

		$trainer_id = 4443;
		$rfg_ids = toolset_get_related_posts( $trainer_id, 'trainer-coupon', 'parent', 100, 0, $args, 'post_id', 'child');
		$coupon_ids = implode(",", $rfg_ids));

Could you please advise how I can get all Members' post_id related to the $coupon_ids?

Best regards,

Kelvin

#2576841

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

Do you mean that based on the $coupon_ids you get that belongs to specific trainer ID , you want to get the the member IDs that is associated to the $coupon_ids? if yes, you will have to loop through the coupon_ids you get and get the parent using the toolset_get_related_post function and store the found parent in array and later use array_unique function to get unique member IDs.

More info:
- https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_related_post