LLMS_Voucher::get_redemptions_for_code_by_user( int $code_id, int $user_id )
Retrieve the number of times a voucher was redeemed by a specific user
Description Description
Hint, it should always be 1 or 0
Parameters Parameters
- $code_id
-
(int) (Required) Voucher Code ID from wp_lifterlms_vouchers_codes table.
- $user_id
-
(int) (Required) User ID from wp_users tables.
Return Return
(int)
Source Source
File: includes/class.llms.voucher.php
public function get_redemptions_for_code_by_user( $code_id, $user_id ) { global $wpdb; return $wpdb->get_var( $wpdb->prepare( "SELECT count(id) FROM {$this->get_redemptions_table_name()} WHERE user_id = %d and code_id = %d", // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared array( $user_id, $code_id ) ) ); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
2.0.0 | Introduced. |