Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.67 KB | None | 0 0
  1.     function remove_core_updates2(){
  2.         global $wp_version;return(object) array('last_checked'=> time(),'version_checked'=> $wp_version,);
  3.     }
  4.     add_filter('pre_site_transient_update_core','remove_core_updates2');
  5.     add_filter('pre_site_transient_update_plugins','remove_core_updates2');
  6.     add_filter('pre_site_transient_update_themes','remove_core_updates2');
  7.    
  8.    
  9.     add_filter( 'woocommerce_checkout_fields', 'wc_add_confirm_password_checkout', 10, 1 );
  10.     function wc_add_confirm_password_checkout( $checkout_fields ) {
  11.         if ( get_option( 'woocommerce_registration_generate_password' ) == 'no' ) {
  12.             $checkout_fields['account']['account_password2'] = array(
  13.                 'type'              => 'password',
  14.                 'label'             => __( 'Confirm password', 'woocommerce' ),
  15.                 'required'          => true,
  16.                 'placeholder'       => _x( 'Confirm Password', 'placeholder', 'woocommerce' )
  17.             );
  18.         }
  19.  
  20.         return $checkout_fields;
  21.     }
  22.  
  23.     // Check the password and confirm password fields match before allow checkout to proceed.
  24.     add_action( 'woocommerce_after_checkout_validation', 'wc_check_confirm_password_matches_checkout', 10, 2 );
  25.     function wc_check_confirm_password_matches_checkout( $posted ) {
  26.         $checkout = WC()->checkout;
  27.         if ( ! is_user_logged_in() && ( $checkout->must_create_account || ! empty( $posted['createaccount'] ) ) ) {
  28.             if ( strcmp( $posted['account_password'], $posted['account_password2'] ) !== 0 ) {
  29.                 wc_add_notice( __( 'Passwords do not match.', 'woocommerce' ), 'error' );
  30.             }
  31.         }
  32.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement