Filtering Appointments+ Backend for Service Provider

Hi

I have some custom code working as per this thread

https://premium.wpmudev.org/forums/topic/make-appointments-plugin-viewable-to-non-admin-roles

It's a superb bit of code for me and something I think should be part of the main plugin. I'm very grateful for getting this working.

However I'd like some help taking a step further please. My Service Providers are set up as "Editors". When they log into the backend of wordpress they only see their own appointments and when they click export they can only export their own appointments. It's working great!

But it would be great that when they were booking new appointments the only service provider they could pick would be themselves and the only service names they could pick would be the ones they are linked to in the Settings>Service Prioviders set up page

Any help much appreciated. As it's just filtering I would hope it's possible

My final step would be for me to set up another user where I can choose which service providers (and therefore service names) they can see. Like a supervisor level but for now I'd be happy to just get it filtering properly!

Many Thanks
Kieran

  • Adam Czajczyk
    • Support Gorilla

    Hello Kieran,

    I hope you're well today and thank you for your question!

    I checked your other thread and I see that it was my colleague Panos who provided the code for you. I believe some sort of filtering could be possible here but it would be best if Panos could take a look at this.

    I have already asked him for help and one of us will get back to your soon. Please keep an eye on this thread for further information.

    Best regards,
    Adam

  • Kieran
    • The Crimson Coder

    Hi Panos,

    Just wondering if you've had chance to look at this yet?

    Also The custom code mention in the original question has stopped working as I had to upgrade the Appointments plugin. I'm hoping you can tweak for me

    Will post in that thread now

    Regards
    Kieran

  • Predrag Dubajic
    • Support

    Hi Kieran,

    Apologies for the extreme delay on this one, I had a chat with Panos about this and he did had a look at this but it turned out there's no quick workaround and that's why he was unable to provide you with a solution so far.
    He still has it on his table but we can't give you much info about when it may be further worked on due to his task queue :slight_frown:

    If you're in a hurry to customize this then you can post a job in our job board where you can hire a developer to assist further:
    http://premium.wpmudev.org/wpmu-jobs/
    Please note that, no WPMU official staff members are allowed to work in the job board.

    Best regards,
    Predrag

  • Panos
    • SLS

    Hi Kieran ,

    Could you please try the mu-plugin from here: https://gist.github.com/panoslyrakis/825e2d6c6c191b9c5427a4b9462868a8

    It should add a new admin menu for providers from where they can:
    a. Edit only their own appointments
    b. Export only their own appointments
    c. When creating a new appointment they can select only their selves as providers

    So you should not be needing the previous mu-plugin for this.

    Service provider should at least have the "edit_published_posts" capability. You can check her : https://codex.wordpress.org/Roles_and_Capabilities for capabilities.

    Please let us know how this works for you :slight_smile:

    Thanks!

  • Kieran
    • The Crimson Coder

    Hi panos,

    This piece of code is currently working really well for me. Can we get it put into the main plugin you think? I think others would like a "manage Service Providers" menu. In fact I've seen it as a premium extension on other plugins.

    Additionally is it possible to tweak the code so that I can have a supervisor user role please. Currently my service providers are set to editors. The code only lets them see their own appointments. Fantastic. But I'd like my team leaders / receptionists to see groups of therapists. Can we say if I set a user up as a contributor I am able to pick which service provider appointments they can see. Using the user ID maybe? That way I can get my receptionists at different locations managing the service providers properly

    Kind Regards
    Kieran

  • Panos
    • SLS

    Hi there Kieran ,

    I have made some modifications on the script and hopefully it's close enough to what you need.

    First you need a way to set which providers will a provider be supervisor of. For that I have added a meta field in the user's profile/edit page for selecting those providers, called Supervisor options. Only the administrator can view that field so no one else can change that.

    Once that is set, that provider will be able to choose other providers from the Filter by service provider dropdown and see/edit the appointments of those providers too.

    You can download the mu-plugin from here :
    https://gist.github.com/wpmudev-sls/6047e9bfb8f1da256fb42db1e0a6ae05
    and replace the previous one.

    Hope it helps :slight_smile:

    Kind regards!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.