Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
LLMS_Certificate_User::has_user_earned()
Check if the user has already earned this achievement used to prevent duplicates
Return Return
(boolean)
Source Source
File: includes/certificates/class.llms.certificate.user.php
private function has_user_earned() { global $wpdb; $count = (int) $wpdb->get_var( $wpdb->prepare( " SELECT COUNT( pm.meta_id ) FROM {$wpdb->postmeta} AS pm JOIN {$wpdb->prefix}lifterlms_user_postmeta AS upm ON pm.post_id = upm.meta_value WHERE pm.meta_key = '_llms_certificate_template' AND pm.meta_value = %d AND upm.meta_key = '_certificate_earned' AND upm.user_id = %d AND upm.post_id = %d LIMIT 1 ;", array( $this->certificate_template_id, $this->userid, $this->lesson_id ) ) ); /** * Deprecated. * * @since Unknown. * @deprecated 6.0.0 Filter `llms_certificate_has_user_earned` is deprecated in favor of `llms_earned_certificate_dupcheck`. * * @param boolean $has_earned Whether or not the certificate has been earned. * @param LLMS_Certificate_User $user_cert The user certificate object. */ return apply_filters_deprecated( 'llms_certificate_has_user_earned', array( ( $count >= 1 ), $this ), 'llms_earned_certificate_dupcheck' ); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.4.1 | |
3.17.4 | Introduced. |