• In the “Details” step, the name and email input fields get prefilled with the name and email from the WordPress user, if the user is currently logged in.

    How can this be disabled?

    In my usecase I don’t want the users email to be used as the appointment email, and neither the name. Both because of privacy reasons caused by our type of service.

    How can this be accomplished?

    I’m able to code PHP, so are there maybe some filters I can use?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Bookly

    (@ladela)

    Hello Julian,

    Thank you for your message.

    I’m afraid such option is not supported.

    Let me know if you have any other questions.

    Thread Starter Julian Weiland

    (@derweili)

    I just looked into the code and found the place where the user data is loaded:

    lib/UserBookingData.php:159

    
    /**
         * Constructor.
         *
         * @param $form_id
         */
        public function __construct( $form_id )
        {
            $this->form_id = $form_id;
            $this->cart    = new Cart( $this );
            $this->chain   = new Chain();
    
            // If logged in then set name, email and if existing customer then also phone.
            $current_user = wp_get_current_user(); // this is where the WordPress user data is loaded
            if ( $current_user && $current_user->ID ) {
                $customer = new Entities\Customer();
                if ( $customer->loadBy( array( 'wp_user_id' => $current_user->ID ) ) ) {
                    $date = explode( '-', $customer->getBirthday() );
    

    If the $current_user variable could be changed to false, the data would not be loaded from the WordPress User.

    Unfortunately, there is no filter to modify this. Could you please add a filter here.

    You could implement it like this:

    // If logged in then set name, email and if existing customer then also phone.
            $load_user_data = apply_filters( 'bookly_user_booking_data_load_wp_user_data', true );
            $current_user = $load_user_data ? wp_get_current_user() : false;
    
            if ( $current_user && $current_user->ID ) {

    This would not change anything for all existing users, but would add additional options for developers.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Disable Prefill from WordPress User Infos’ is closed to new replies.