llms_locate_order_for_user_and_plan( int $user_id, int $plan_id )
Find an existing order for a given plan by a given user.
Parameters Parameters
- $user_id
-
(int) (Required) The WP_User ID.
- $plan_id
-
(int) (Required) The Access Plan post ID.
Return Return
(mixed) null if no order found, WP_Post ID as an int if found
Source Source
File: includes/functions/llms.functions.order.php
* @since 3.30.1 * * @param int $user_id The WP_User ID. * @param int $plan_id The Access Plan post ID. * @return mixed null if no order found, WP_Post ID as an int if found */ function llms_locate_order_for_user_and_plan( $user_id, $plan_id ) { global $wpdb; // Query. $id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM {$wpdb->prefix}posts AS p JOIN {$wpdb->prefix}postmeta AS pm_user ON pm_user.post_id = p.ID AND pm_user.meta_key = '_llms_user_id' JOIN {$wpdb->prefix}postmeta AS pm_plan ON pm_plan.post_id = p.ID AND pm_plan.meta_key = '_llms_plan_id' WHERE p.post_type = 'llms_order' AND pm_user.meta_value = %d AND pm_plan.meta_value = %d ;", $user_id, $plan_id )
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.30.1 | Introduced. |