Navigation überspringen

[Gelöst] Query the member list from a list of coupons

This support ticket is created vor 2 Jahren, 1 Monat. 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)

Dieses Thema enthält 1 Antwort, hat 2 Stimmen.

Zuletzt aktualisiert von Minesh vor 2 Jahren, 1 Monat.

Assistiert von: Minesh.

Author
Artikel
#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
Unterstützer

Sprachen: Englisch (English )

Zeitzone: 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