llms_find_coupon( string $code = '', int $dupcheck_id )
Get the most recently created coupon ID for a given code
Parameters Parameters
- $code
-
(string) (Optional) The coupon's code (title). Default is empty string.
Default value: ''
- $dupcheck_id
-
(int) (Optional) Coupon id that can be passed which will be excluded during the query this is used to dupcheck the coupon code during coupon creation. Default is 0.
Return Return
(int)
Source Source
File: includes/llms.functions.core.php
732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 | */ function llms_find_coupon( $code = '' , $dupcheck_id = 0 ) { global $wpdb ; return $wpdb ->get_var( $wpdb ->prepare( "SELECT ID FROM { $wpdb ->posts} WHERE post_title = %s AND post_type = 'llms_coupon' AND post_status = 'publish' AND ID != %d ORDER BY ID desc; ", array ( $code , $dupcheck_id ) ) ); // no-cache ok. |
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |