Created
April 27, 2021 05:25
-
-
Save MrVibe/8d60d4ce6b8703779c27fcc51261f1a3 to your computer and use it in GitHub Desktop.
Custom fields in Registration popup v4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Add custom field | |
add_filter('vibebp_vars',function($vars){ | |
$vars['settings']['registration_fields'][]=['type'=>'text','id'=>'XXXXX','label'=>_x('WPLMS Purchase Code','login','vibebp'),'value'=>'','class'=>'input']; | |
return $vars; | |
}); | |
//Process custom field | |
add_filter('vibebp_register_user_bypass',function($flag,$body){ | |
foreach($body as $key => $value){ | |
if($value['type'] == 'password'){ | |
if(empty(sanitize_text_field($value['value']))) | |
return 0; | |
} | |
if($value['type'] == 'email'){ | |
if(empty(sanitize_text_field($value['value']))) | |
return 0; | |
} | |
if($value['id'] == 'XXXXX'){ | |
if(empty($purchase_code)){ | |
return 0; | |
}else{ | |
//Perform action | |
return 1; | |
} | |
} | |
} | |
return 0; | |
},10,2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment