Advertisement
verygoodplugins

Untitled

Jan 28th, 2020
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.60 KB | None | 0 0
  1. function custom_format_checkbox( $value, $field_type, $field ) {
  2.  
  3.     if ( $value == 'Yes' ) {
  4.         $value = true;
  5.     } elseif ( $value == 'No' ) {
  6.         $value = false;
  7.     }
  8.  
  9.     return $value;
  10.  
  11. }
  12.  
  13. add_filter( 'wpf_format_field_value', 'custom_format_checkbox', 20, 3 );
  14.  
  15. function wpf_load_checkboxes_yes_no( $user_meta, $user_id ) {
  16.  
  17.     foreach ( $user_meta as $key => $value ) {
  18.         if ( $value === true ) {
  19.             $user_meta[ $key ] = 'Yes';
  20.         } elseif ( $value === null ) {
  21.             $user_meta[ $key ] = 'No';
  22.         }
  23.     }
  24.  
  25.     return $user_meta;
  26.  
  27. }
  28.  
  29. add_filter( 'wpf_pulled_user_meta', 'wpf_load_checkboxes_yes_no', 10, 2 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement