Appointment+ change user role + emails

I have 2 questions:
1. I would like to change the role of the user after the appointment is approved. is there any hook I can use in order to do that (that I know the user_id)? all my users are sign on to see the appointment page so no problem there...
2. for some reason I cannot see the confirmation emails . it was working and stop. maybe beacuse I am using html in that area?

Site: Xsmokers4u.com

Thanks,
Elad

  • Jude

    Howdy Elad

    Hope you are keeping well and welcome to the community !

    1. I would like to change the role of the user after the appointment is approved. is there any hook I can use in order to do that (that I know the user_id)? all my users are sign on to see the appointment page so no problem there...

    Take a look at this filter, it should give you all the data you need once the appointment is approved. If the status is paid , then you are good to go

    $status = apply_filters('app_post_confirmation_status', $status, $price, $service, $worker, $user_id);

    2. for some reason I cannot see the confirmation emails . it was working and stop. maybe beacuse I am using html in that area?

    You can try to change the headers to permit HTML emails as shown below

    https://gist.github.com/JudeRosario/bc4e4ce698dd645acf54

    Let me know if that works !

    Cheers
    Jude

  • Elad

    Hi ,

    Thank you very much , both are solved!

    But i have another 2 issues :slight_smile:

    1. I am not using any payment on my site for the appointment , is there any way I can change the status automatically to "Active" when the meeting is created . I put the flag "Auto confirm" as "Yes" but it does not look like it is working
    2. When deleting a user I get this error
    "string(12) "NOT A WORKER"
    Warning: Cannot modify header information - headers already sent by (output started at /home/xsmoker7/public_html/wp-content/plugins/appointments/includes/class-app-worker.php:657) in/home/xsmoker7/public_html/wp-includes/pluggable.php on line 1171

    The user is deleted but the error is not nice and it is removing me from the WP site.

    Thanks,
    Elad

  • Michael Bissett

    Hey Elad,

    #1: I'm not able to reproduce this one, I'm seeing that they're auto-confirmed on my site. Could you please enable Support Access to your site?

    https://premium.wpmudev.org/manuals/wpmu-dev-dashboard-enabling-staff-login/

    Also, what would be the appointment page in question, could you provide a link to it, please?

    #2: This is something I can reproduce, I'll let the developer know about it. In the meantime, you can log into your site via FTP, and replace this file:

    /appointments/includes/class-app-worker.php

    With the file inside the attached .zip file.

    Kind Regards,
    Michael

  • Michael Bissett

    Hey Elad,

    I see that "Payment Required" was set to "Yes", inside of:

    Appointments -> Settings -> General

    I've set that to "No" now, as that overrides the Auto Confirm setting (and I didn't see that any payment details were entered in there).

    However, in the process of testing this, the code that you'd created for changing the role has now changed the admin user's role, so he's no longer an admin.

    Please download the attached .zip file, and upload the file inside of it via FTP to:

    /wp-content/mu-plugins (create the folder if it doesn't exist)

    You'll want to log in with your admin account, and then visit:

    xsmokers4u.com/?set_admin=true

    Once you do that, your admin user should have his admin privileges restored. You'll want to remove that plugin afterwards, so that nobody else can use it in the future.

    Kind Regards,
    Michael

  • Elad

    Hi,

    Thanks for quick response and for that! I put a validation not to change the admin role . but I think this not solve my problem yet... Sorry! not sure if I was clear
    I do not use payment from the booking , but I do need the meeting to be transfer directly to active without pending .No manual validation of the meeting is required...
    I was sure this is the flag I changed... but I guess I was wrong... is there any place in the code (better in a hook) I can change in order for the appointment to go directly to active ?

    Thanks,
    Elad

  • Michael Bissett

    Hey Elad,

    With "Auto confirm" set to "Yes" & "Payment Required" set to "No", no code should be needed.

    Does this only occur with your custom code in place here? I'm seeing that appointments are being set to "Active" over on my test site.

    If removing your custom code doesn't get this working, then it's possible that there's a conflict somewhere, I'd advise going through the flowchart we have at the bottom of our Getting Support page:

    https://premium.wpmudev.org/manuals/using-wpmu-dev/getting-support/

    Please advise,
    Michael

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.