Support forumUser roles management still missing
Lars asked 1 year ago

After 3 years “on top of the list” this feature is still missing or how can we allow non-admins to change settings/configuration of appointments?

User Permissions – Editor

4 Answers
Nikola Loncar Staff answered 1 year ago

Hi Lars it is not yet added. If you want quick fix for that one we can expose hooks for accessing pages depending on roles so you can alter rights on the fly. But you will need additional code from your side for using hooks.

Best regards,
Nikola

Lars replied 1 year ago

That would be very helpful. Currently I hardcoded it into the plugin (not update-proof)
Can you post/send the hooks, please?

Lars replied 1 year ago

Havent heard from you. Can you provide the code, please?

Lars replied 12 months ago

What do you mean by “quick fix”? 😀
2 weeks, not yet one reply

Nikola Loncar Staff answered 12 months ago

Hi Lars, sorry for that we are planning new release by end of this week. There were some delays.

Best regards,
Nikola

Lars replied 11 months ago

Okay there is finally your update but still lacking the code you were mentioning more than a month ago.

Lars replied 11 months ago

wow, what a big disappointment this is. 2 months. promises but no help in the end.

Lars replied 11 months ago

3 new updates since you said you would offer us the needed part of code.
Is this a joke to you?

Nikola Loncar Staff replied 11 months ago

Hi, sorry for waiting 🙁 we will release next version within next 24 hours with only that code improvement.

Best regards,
Nikola

Lars replied 10 months ago

Hi. I see a new version but not settings or info what to change.
ajax.php contains “manage_posts”,
admin.php contains a “user_capability_callback” but also no backend settings/infos

Lars replied 10 months ago

After searching the docs, there is a small info about the new filter but it’s totally incomplete.
What is the purpose of showing the menu slugs to special user roles when the ajax call is forbidden and so NO content at all is shown at each menu slug.

ajax.php line 1085: private function validate_access_rights()

This must be filtered and probably line 107, too.

Did you even test this before you release it?

Nikola Loncar Staff answered 10 months ago

Hi Lars, it will be also applied there as well (ajax cals). We will release fix for it during the day.

Best regards,
Nikola

Lars replied 10 months ago

After updating to the latest version and using the filter, none of the ajax calls work anymore

Error 400 response
Response is: 0
Example: wp-admin/admin-ajax.php?=&_wpnonce=2705a95683&action=ea_services

Nikola Loncar Staff answered 10 months ago

Hi Lars it has been updated. There is additional hook for ajax admin part. More on that on Hooks and callbacks

Best regards,
Nikola

Lars replied 10 months ago

Thanks for fixing the ajax call but now everything is broken. When trying to access the top menu, it says “you are not allowed to view the page” This code is in the functions and worked before the latest update:

add_filter(‘easy-appointments-user-menu-capabilities’, ‘custom_capabilities’, 10, 2);
function custom_capabilities($default_capability, $menu_slug) {
$menus = array(‘easy_app_top_level’,’easy_app_locations’,’easy_app_services’,’easy_app_workers’,’easy_app_connections’,’easy_app_vacation’,’easy_app_reports’,’easy_app_new_reports’);
return ( current_user_can( ‘manage_woocommerce’ ) && in_array($menu_slug,$menus) ) ? ‘manage_woocommerce’ : $default_capability;
}

Lars replied 10 months ago

Same for the ajax call on a submenu page:
Error 400 response

Example: wp-admin/admin-ajax.php?=&_wpnonce=2705a95683&action=ea_services
Response is: 0

I really wonder if my approach is faulty or you do not test this at all?

Lars replied 10 months ago

Can you check this. please? Ajax Calls are not working with the new hook.

Lars replied 10 months ago

Hello?

Lars replied 9 months ago

Why even ask…