• bling007

    (@bling007)


    Hi,

    How to set up the plugin? It is unable to find the phone number. What field does it look for?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author xootix

    (@xootix)

    Hello,

    Plugin has its own phone field, you can find it on users profile page. You need to register user first using this plugin for login to work.

    Thread Starter bling007

    (@bling007)

    What do you plan for already registered users?

    Thread Starter bling007

    (@bling007)

    What about users who are already registered?!

    Plugin Author xootix

    (@xootix)

    Merging with existing billing phone number is complicated.
    In woocommerce by default, two ( or more ) different users can have same billing phone number. There is no check.
    But for login purpose, phone number needs to be unique.

    You can use the below code to merge existing billing phone number with plugin phone number field. (Goes in functions.php)

    1) Change +91 below to your country code if not India
    2) Visit https://www.yourwebsite.com/wp-admin/admin.php?page=xoo-ml, the code will run & it may take few seconds to load page.
    Once the page is loaded, you can remove the code.

    add_action( 'init', function(){
     
     
        if( !is_admin() || wp_doing_ajax() || !isset( $_GET['page'] ) || $_GET['page'] !== 'xoo-ml' ) return; // run only on otp settings page
    
        $args = array(
            'role'    => 'customer',
        );
    
        $users = get_users( $args );
    
        $phone_code = '+91';
    
        //loop users
        foreach ( $users as $user ) {
    
                    
            $billing_phone = get_user_meta( $user->ID, 'billing_phone', true ); //Get billing phone
    
            if( !$billing_phone ) continue; // switch to next user if billing phone is empty
    
            update_user_meta( $user->ID, 'xoo_ml_phone_code', $phone_code ); //Update phone code required for login
    
            update_user_meta( $user->ID, 'xoo_ml_phone_no', $billing_phone ); //Update phone number required for login
    
            update_user_meta( $user->ID, 'xoo_ml_phone_display', $phone_code.$billing_phone ); // Just for display
    
        }
     
    } );
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Phone Number not found!’ is closed to new replies.