when appointment is made by admin the client name is not in email

As an admin when I go into the appointments dashboard in wordpress and click "add new" appointment.

I select a user from the dropdown and create the time etc. (I do not fill in the name field)

When the confirmation email gets sent out to the user, the client name is not filled in. When the email gets sent out to the admin/service provider the client name is filled in.

I know that if I want to users name (CLIENT) to appear in the email that gets sent to them, I need to fill in the name field but unsure why the admin/service provider get the name in the confirmation email even when its not filled out.

Any way to change this?

  • Tyler Postle
    • CGO

    Hey again Judah :slight_smile:

    I've tested this on my own installation and it's working as expected for me. It shows the user name when "CLIENT" is entered and doesn't show anything when it's not.

    I notice you are using a 1.4.7 beta version of the plugin, is that right? That could be the reason there as the beta's are not guaranteed to be stable.

    We should have an official release of 1.4.7 soon :slight_smile:

    If you don't mind we can still take a closer look at this for you, just grant us support access via:

    admin dashboard - WPMU DEV > Support > Support Access > Grant Access.

    Look forward to hearing back Judah!

    Cheers.
    Tyler

  • Ash
    • WordPress Hacker

    Hello @Judah

    I hope you are well today.

    I have just tried in my test site, and when I don't give any name then neither provider nor client gets a name in the email, screenshot attached.

    but unsure why the admin/service provider get the name in the confirmation email even when its not filled out.

    Whose name is sent in the email to the providers? Would you please post a screenshot? And do you have any external code that is being used in functions.php or mu-plugins etc?

    Cheers
    Ash

  • Judah
    • New Recruit

    Hey @Ashok,

    Here is a screenshot of the fields I am not filling in/referring to.

    When I create an appointment in the Admin end, and I select a user, I should not have to enter in the information in the fields marked in the screenshot, they should auto fill, based on the user I have selected in the Dropdown.

  • Tyler Postle
    • CGO

    Hey Judah,

    Hope you're doing well today!

    Once the Appointment is saved then it will fill in those fields. Assuming that the user in question has the Appointment profile fields saved in their profile. So first you can go to their profile and scroll down to the Appointments fields and make sure they are saved there. If they are, then after you save the Appointment, it will fill in those fields from the user selected :slight_smile:

    Let us know if this still isn't working for you! Look forward to hearing back.

    All the best,
    Tyler

  • Judah
    • New Recruit

    Hey @Tyler Postle,

    Please see the following screencast of the process I go through while creating an appointment.

    First it shows the user that I am creating a lesson for. It shows they have a first name and email in their wordpress account.

    I than create a new appointment and save it - without filling in the name/email fields. When I refresh that page - no fields are filled in.

    When the user creates an appointment, their information is filled in for them.

    Please let me know if you can figure out what is going on.

    Thanks,
    Judah

  • Judah
    • New Recruit

    Hey @Calvin,

    Thank you for the suggestion.

    When I went into the users' profile - the Appointments+ section was greyed out and I could not enter any information :slight_frown:

    Also - I could not see the appointments that the user currently had, in their WP profile Appointments+ section. (I had a separate post on this but gave up as I have the beta version installed and don't want to uninstall this version for the older one)

  • calvinrogercanas
    • New Recruit

    Hey there @Judah,

    You are welcome :slight_smile:

    When I went into the users' profile - the Appointments+ section was greyed out and I could not enter any information :slight_frown:

    I could confirmed this with my own install. So for that reason, I am marking this as feature request. I think admin should have a privilege to edit the client/user 's apps+ information.

    Also - I could not see the appointments that the user currently had, in their WP profile Appointments+ section. (I had a separate post on this but gave up as I have the beta version installed and don't want to uninstall this version for the older one)

    Can you link the thread for this one? We should expect something like this on beta version of any plugin. Since this version is unstable and may output error or bug.

    Let me know if it helps! :slight_smile:

    Best Regards,
    Calvin

  • Judah
    • New Recruit

    Hey @Calvin,

    Thank you for confirming that and moving it to the feature request section.

    The issue I'm having is that if I as an admin am making a manual appointment in the system and I select a registered user, that users' information should pop up in the appointment fields. So if I don't know the users email address, but they have it in their account, it should populate when I create a new appointment for them. As of this time, whenever they (the users) create/book an appointment in the system, their information does get applied to those fields/the appointment.

    Here is the thread that I referenced earlier about not seeing the booked appointments in the users WP profile. Could be a plugin conflict or have something to do with the beta version. It is not a major/crucial issue for me as my users have no access to WP. I display all their appointment information via shortcodes.

    Thanks for following up with me on this one.

    Judah

  • Judah
    • New Recruit

    Hey @Calvin,

    I wanted to follow up on this issue as I will now be making more appointments manually and I need the users profile information to automatically be generated in the admin New appointment section when I select a user from my system.

    Please let me know if you have any additional information.

    Thanks,
    Judah

  • Ash
    • WordPress Hacker

    Hello @Judah

    I hope you are well today.

    Please try the following code:

    add_filter( 'app-appointment-inline_edit-save_data', 'app_inline_save_cb' );
    function app_inline_save_cb( $data ){
    	if ( username_exists( $data['user'] ) ){
    		$user = get_user_by( 'login', $data['user'] );
    		$data['email'] = $data['email'] == '' ? $user->user_email : $data['email'];
    		$data['name'] = $data['name'] == '' ? $user->display_name : $data['name'];
    	}
    	return $data;
    }

    We can't map the address, city, phone etc fields as it must needs to be mapped with the A+ fields in the profile page. The above code should map the display name and email if you leave them blank.

    You can add those codes in your functions.php in the theme, if you think your theme won’t be changed. Otherwise mu-plugins is the best solution. To use mu-plugins, go to /wp-content/ and find the folder with name 'mu-plugins'. If there is no folder in that name, then create a folder, name it 'mu-plugins', create a file inside that, give any name you like and paste the code in there. You don't need to activate that plugin. Mu-plugins means must use plugins, so it will be activated automatically always. If you use mu-plugins then add a php start tag at the beginning of the code.

    Hope it helps :slight_smile: Please feel free to ask more question if you have any.

    Cheers
    Ash

  • Ash
    • WordPress Hacker

    Hello @Judah

    Please try the following code and check if it auto saves the name and email field.

    add_filter( 'app-appointment-inline_edit-save_data', 'app_inline_save_cb' );
    function app_inline_save_cb( $data ){
    	$user = get_userdata( $data['user'] );
    	if ( username_exists( $user->user_login ) ){
    		$data['email'] = $data['email'] == '' ? $user->user_email : $data['email'];
    		$data['name'] = $data['name'] == '' ? $user->display_name : $data['name'];
    	}
    	return $data;
    }

    Hope it helps :slight_smile: Please feel free to ask more question if you have any.

    Cheers
    Ash

  • Judah
    • New Recruit

    Hey @Ashok,

    I already have and Jude was very kind and supportive. I need to respond to him with the field ID I am currently using but I have no idea how to do that. Still waiting to hear back from another Developer so they can help me out.

    I appreciate it!

    Thanks,
    Judah

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.