· 6 years ago · May 03, 2019, 01:28 AM
1if( ! function_exists( 'jh_child_custom_is_recaptcha_available' ) ) {
2 function jh_child_custom_is_recaptcha_available() {
3 $site_key = get_option( 'job_manager_recaptcha_site_key' );
4 $secret_key = get_option( 'job_manager_recaptcha_secret_key' );
5 $is_recaptcha_available = ! empty( $site_key ) && ! empty( $secret_key );
6
7 return apply_filters( 'job_manager_is_recaptcha_available', $is_recaptcha_available );
8 }
9}
10
11if( ! function_exists( 'jh_child_custom_display_recaptcha_field' ) ) {
12 function jh_child_custom_display_recaptcha_field() {
13 $field = array();
14 $field['label'] = get_option( 'job_manager_recaptcha_label' );
15 $field['required'] = true;
16 $field['site_key'] = get_option( 'job_manager_recaptcha_site_key' );
17 get_job_manager_template(
18 'form-fields/recaptcha-field.php',
19 array(
20 'key' => 'recaptcha',
21 'field' => $field,
22 )
23 );
24 }
25}
26
27if( jh_child_custom_is_recaptcha_available() ) {
28 add_action( 'jobhunt_registration_form_fields_after', 'jh_child_custom_display_recaptcha_field' );
29}