Public Ticket #3731243

Block auto fill username field during adding a new client

Closed
Comments
9 Tickets 2
Lukasz started the conversation 2 years ago on September 24, 2024 at 12:30pm

Hi, During adding new customer in chrome browser there is username and password field filled automatically. Is there any simple way to block it?

It is possible for the username and password to be generated automatically, e.g. based on the email address or name and surname. and remove this field.

Why agent has come up with the password? It should be generate automatically (agent shouldn't know it)


2,762
KingsPlugins replied 2 years ago on September 26, 2024 at 4:25am

Hi,

It is possible to remove the username and password field, and have them generated automatically.

To do this, add the following PHP snippet to your site:

add_action('salesking_dashboard_head', function(){
    ?>
    <script>
        jQuery(document).ready(function(){
            jQuery('#salesking_add_customer_form #username').parent().parent().remove();
            jQuery('#salesking_add_customer_form #password').parent().parent().remove();
        });
    </script>
    <?php
});
add_filter('salesking_filter_newcustomer_username', function($user){
    return sanitize_text_field($_POST['emailaddress']);
}, 10, 1);
add_filter('salesking_filter_newcustomer_password', function($password){
    return wp_generate_password();
}, 10, 1);

 

A PHP snippet can be added to functions.php, or by following our guide here: https://b2bkingplugin.com/docs/how-to-add-a-snippet-php-or-js/

 

It will then show only an email field and generated the rest automatically.

 

Kind regards,

Stefan

Sign In