Friday, February 17, 2023
HomeWordPress Developmentcapabilities - How do I validate further subject (ABN) for entire sale...

capabilities – How do I validate further subject (ABN) for entire sale buyer on my WordPress wholesale’s web page?


I’ve a customized subject (ABN) in my registration kind for wholesale buyer (Wholesale plugin – Wpexperts)
https://amocanailsbeautysupply.com.au/wholesale-login/

To stop duplicate ABN, (no clients ought to register the identical ABN quantity within the database) there’s management but when I’ve a customized subject I created how can I verify it? many thanks

add_filter( 'wpwholesale_registration_errors', 'validate_unique_abn', 10, 2 );
perform validate_unique_abn( $errors, $sanitized_user_login ) {
    if ( isset( $_POST['abn'] ) && ! empty( $_POST['abn'] ) ) {
          $abn = sanitize_text_field( $_POST['abn'] );
          $existing_user = get_users( array(
                        'meta_key' => 'abn',
                         'meta_value' => $abn, 
                          'fields' => 'ID',
           ) );
  if ( ! empty( $existing_user ) ) {
     $errors->add( 'abn_error', __( 'This ABN is already registered. Please enter a novel ABN.', 'wpwholesale' ) );
   }
 }
return $errors;
}

enter image description here
enter image description here

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments