Tribe__Tickets__Commerce__PayPal__Main::get_post_id_from_order( string $order )
Returns the ID of the post associated with a PayPal order if any.
Contents
Parameters
- $order
-
(string) (Required) The alphanumeric order identification string.
Return
(int|false) Either the ID of the post associated with the order or false on failure.
Source
File: src/Tribe/Commerce/PayPal/Main.php
public function get_post_id_from_order( $order ) {
if ( empty( $order ) ) {
return false;
}
global $wpdb;
$post_id = $wpdb->get_var( $wpdb->prepare(
"SELECT m2.meta_value
FROM {$wpdb->postmeta} m1
JOIN {$wpdb->postmeta} m2
ON m1.post_id = m2.post_id
WHERE m1.meta_key = %s
AND m1.meta_value = %s
AND m2.meta_key = %s",
$this->order_key, $order, $this->attendee_event_key )
);
return empty( $post_id ) ? false : $post_id;
}
Changelog
| Version | Description |
|---|---|
| 4.7 | Introduced. |