[Appointments+] Appointment + not responding well with theme layout

Hi,
I need help to fix a couple things:
1. Need to remove certain service options based on user role.
2. When there many service providers, the drop-down box - will it show a scroll bar?
Thanks,
Sujee

  • Predrag Dubajic

    Hi Sujee,

    Hope you're doing well.

    1. Need to remove certain service options based on user role.

    I'm afraid that this is not possible out of the box and to accomplish this you will need to either custom code it or combine it with another plugin.
    For example, you can use our Membership 2 plugin and assign capabilities based on the membership, pretty much membership assigned will be the role of your user.

    After that, you can add multiple booking forms on the same page but use membership shortcodes to show certain form for selected membership.
    You can check available Membership 2 shortcodes in Membership 2 > Help > Shortcodes panel once you install the plugin.

    2. When there many service providers, the drop-down box - will it show a scroll bar?

    It will adjust to the screen height and add a scroll if the entire list can't fit in the screen.

    Best regards,
    Predrag

  • Sujee

    Predrag,

    Thank you! Much appreciated. I've been experiencing problems once clients confirm an appointment. I've included an image here and pointed out the problem.

    Also, I figured I might be able to use a quick snippet based on current user role and removing specific services from being retrieved. That was my goal with my first question. I use 'visual composer' and can add custom code to reflect just on that page alone. If you can help with the code, that would be awesome.

    Looking forward to hearing back from you.

    Sujee

  • Predrag Dubajic

    Hi Sujee,

    Thank you! Much appreciated. I've been experiencing problems once clients confirm an appointment. I've included an image here and pointed out the problem.

    Looks like I need to be logged in to access this page, so could you grant me support access so I could check it out?
    To enable support access you can follow this guide here:
    https://premium.wpmudev.org/docs/getting-started/getting-support/#chapter-5

    Also, I figured I might be able to use a quick snippet based on current user role and removing specific services from being retrieved. That was my goal with my first question. I use 'visual composer' and can add custom code to reflect just on that page alone. If you can help with the code, that would be awesome.

    I'm not sure that I understand completely this part, perhaps because I'm not fully familiar with Visual Composer, so I would appreciate some more info about this?
    Does VC has an option to show blocks/elements on page based on the user role and you wish to use that to accomplish your desired setup?

    Best regards,
    Predrag

  • Sujee

    Hi Predrag,

    Edit by Predrag: Removed login details

    Thank you for your reply. My apologies as the visual composer I had mentioned is only for custom CSS and for my purpose, I would need to do some PHP configurations? All I had hoped to do - I am a novice in the area, I might be oversimplifying it - is adding a code that detects current user and then not retrieving certain services for that user. For example, I found this snippet that checks user roles and then can apply something to stop certain services from showing up?

    <?php
    if( current_user_can('College') ) {
    // true if user is an College
    }

    if( !current_user_can('administrator') ) {
    // true if user is not admin
    }
    ?>

    Thanks again for your prompt reply and support.

    Sujee

  • Predrag Dubajic

    Hi Sujee,

    Thanks for the additional info.

    Doing it this way should be possible if you setup Appointments plugin for that specific case and then register a new shortcode to be used.

    First thing is to create different providers that we can then use to show different service.
    For example, have one provider that will be doing services for "College" roles, one for "Admin" roles and one for the rest of them.

    Once you have service providers configured you will need to register new shortcode by adding below code in your child theme or as mu-plugin:

    function custom_appointment_shortcode() {
    
    	if( current_user_can( 'College' ) && !current_user_can( 'administrator' ) ) {
    
    	   return do_shortcode( '[app_services worker="1"]' );
    
    	} elseif( !current_user_can( 'administrator' ) && !current_user_can( 'College' ) ) {
    
    	   return do_shortcode( '[app_services worker="3"]' );
    
    	} else {
    
    	   return do_shortcode( '[app_services worker="6"]' );
    
    	}
    
    }
    add_shortcode( 'app_based_on_role', 'custom_appointment_shortcode' );

    Note that worker ID's need to be adjusted for your specific case, in above example services with worker ID 1 will show for "College" role.

    So what's left now is to adjust your appointment page and replace service selector with your new shortcode.
    Basically you will need to replace [app_services] with [app_based_on_role].

    For example, if your current shortcode structure looks like this:

    [app_services]
    [app_monthly_schedule]
    [app_pagination month="1"anchors="0"]
    [app_confirmation]

    You will need to replace it with this:

    [app_based_on_role]
    [app_monthly_schedule]
    [app_pagination month="1"anchors="0"]
    [app_confirmation]

    After that when you load the page the app_service shortcode will be loaded based on the role and thus show different services.

    Hope this helps :slight_smile:

    Best regards,
    Predrag

  • Predrag Dubajic

    Hi Sujee,

    Thanks for the additional info and screenshots, it does better explain the setup you're after but unfortunately, this is not possible to accomplish this way :slight_frown:
    Thing is that we need to use [app_services] with "worker" attribute in order to show specific appointments based on something, worker in this case.

    Problem here is that worker attribute can only have one value, so using [app_services worker="1,2,3"] will not work.

    So in order to use above solution, you will need to have Workers that match your roles you want to hide/show.
    For example, if you have three services you want to show to College role you will need to have all three of those services assigned to the same provider.

    Best regards,
    Predrag

  • Sujee

    Hi Predrag,

    Thank you so much for the clarification. I do have a situation that may apply. The user roles 'Student' should only have access to the 'Admission Counselors' worker and nothing else. Since it is just 1 worker with just 1 service, then this would work? This would mean that the shortcode would only be applied in this instance and not others - is that possible?

    Thanks in advance!

    Sujee

  • Predrag Dubajic

    Hi Sujee,

    In that case, we should be able to do it fairly easily, basically we will modify the previous code so that one worker is shown for Student and all of them for all the others, it will look something like this:

    function custom_appointment_shortcode() {
    
    	if( current_user_can( 'Student' ) ) {
    
    	   return do_shortcode( '[app_services worker="1"]' );
    
    	} else {
    
    	   return do_shortcode( '[app_services]' );
    
    	}
    
    }
    add_shortcode( 'app_based_on_role', 'custom_appointment_shortcode' );

    For worker set the ID of the worker providing the student appointments and that should be it.

    Hope that does the trick :slight_smile:

    Best regards,
    Predrag

  • Predrag Dubajic

    Hi Sujee,

    Are you referring to doing something like this:

    if( current_user_can( 'Student' ) ) {
    
       return do_shortcode( '[app_services worker="1"]' );
       return do_shortcode( '[app_services worker="2"]' );
       return do_shortcode( '[app_services worker="3"]' );
    
    }

    That won't work I'm afraid because that code would render three different Service selectors and Appointments+ can use only one so it will actually break the booking process if we add more of them.

    Or were you referring to something else?

    Best regards,
    Predrag

    • Adam Czajczyk

      Hello Sujee

      I hope you're well today!

      I checked your site and I can see that there's only one appointment booked in April so I assume that's the one that made you report the issue :slight_smile:

      The thing here is that this appointment is still in "Pending" state, meaning it wasn't confirmed. Notifications are being sent for confirmed bookings and confirmation can only happen in one of two ways:

      - if it's a paid appointment (which it is not), making payment makes it confirmed
      - if it's a free appointment (which it is) you - as an admin/service provider - must go to the "Appointments -> Appointments" page and look at the "Pending" list where you can edit appointment and set its status to "Confirmed".

      After that, the notification should be send.

      You can, however, avoid that and make those bookings to be automatically confirmed (which in turn should also cause e-mails to be send automatically). To do so, go to the "Appointments -> Settings -> Accessibility" page and turn on "Auto Confirm" option there.

      I hope that helps :slight_smile:

      In case it still didn't work for you, please start a separate ticket or join our live support session, since the issue is not strictly related to the original one solved in this ticket and in such cases it's better (and faster) to work on it via its own dedicated ticket. I hope that makes sense :slight_smile:

      Have a nice day!
      Adam

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.