ap_show_captcha_to_user( integer|false $user_id = false )
Description #
Check if user can by pass a captcha.
Parameters #
- $user_idinteger | false (Optional) User ID. Default value: false
Source #
File: includes/class/roles-cap.php
function ap_show_captcha_to_user( $user_id = false ) { if ( false === $user_id ) { $user_id = get_current_user_id(); } // Return false if super admin or ap_moderator. if ( is_super_admin( $user_id ) || user_can( $user_id, 'ap_moderator' ) ) { return false; } if ( apply_filters( 'ap_show_captcha', false, $user_id ) ) { return false; } $current_user = wp_get_current_user(); $opt = ! empty( ap_opt( 'recaptcha_exclude_roles' ) ) ? ap_opt( 'recaptcha_exclude_roles' ) : array(); $opt = array_keys( $opt ); $intersect = array_intersect( $current_user->roles, $opt ); if ( ! empty( $intersect ) && count( $intersect ) > 0 ) { return false; } if ( ap_opt( 'recaptcha_site_key' ) !== '' ) { return true; } return false; }
Expand full source code Collapse full source code View on GitHub: includes/class/roles-cap.php:1094
Add your comment