HD Quiz

Editors no longer have access

Published: December 14, 2024
Support status: closed

HD Quiz settings say that by default, only Editors or Admins can add or edit questions. Yet, our editors have lost access since the recent updates. The function on line 4 in includes/functions.php allows only admins by default by checking for the manage_options capability only admins have. Please change that to publish_pages to also allow Editors by default, as it used to be.

Additionally, if I switch the Allow authors access to create quizzes, our Editors are able to create new quizzes, but they don’t see the existing ones.

thread author: Paulo

In fact, even changing the code in the function manually doesn’t show existing quizzes to Editors, only allows them to create new ones. Only if i give editors the manage_options capability can they see existing quizzes. And sometimes not event that, only access them with a direct link… This breaks our workflow.

14 December 2024 — 20:34 thread author - Paulo

Also found that the classes/question.php, classes/quiz.php, and classes/settings.php files have the check for the manage_options capability hardcoded instead of calling the hdq_user_permission function from includes/functions.php. Changing the three files to check for publish_pages instead, gives Editors the ability to edit existing quizzes, but they still don’t show up on the dashboard and have to be accessed with a direct link (provided by an admin).

14 December 2024 — 21:20 thread author - Paulo

Hi Paulo,
this is a complicated subject, but I’ll try my best to explain.

Changing the permissions to admins only was a very deliberate decision I made. The current HD Quiz permissions logic is this. Are you an admin? Great, full access to everything. Is “Allow authors access to create quizzes” enabled, and the current user has at least author access? Great, they can create and edit their own quizzes only.

I made this because of all the trouble and support I’ve had to give over the years to help people untangle the absolute mess they’ve made with their own site permissions with one of those “change user permission/role” type plugins. I cannot understate some of the crazy user permission configurations I’ve seen (I saw one site where subscriber level users had full delete permissions over all pages and posts). So for now at least, the default permissions I set will remain.

HOWEVER, I will seriously consider some tweaks. For example, being able to see quizzes created by other users in the admin area for Editors, or maybe creating a definition you can add to your site to loosen the admin restrictions to editors as well. I think I’m leaning towards the definition rout since it would be best suited for users like you who know what correct user permissions are while being too technically “advanced” for normal users who would blindingly edit user permissions using a plugin.

In the meantime, you’ve already found all the relevant user permission calls, so feel free to change them to whatever you prefer. The only one you missed is in dashboard.php where there is a call !current_user_can('administrator'). You can change administrator to some other capability, such as publish_pages. This will allow editors to see quizzes created by other users in the admin area.

Also thanks for pointing out the outdated description to the “Allow authors access to create quizzes” still referencing editors. This was a holdover from the previous version of HD Quiz.

15 December 2024 — 17:50 support admin - Dylan

Respond to thread

This thread has been closed / marked as resolved.
You can reply to this thread, but it might be better to start a new thread if you need help
.

You can also upload images to imgur and paste the links here. Just make sure that your images don't include any sensitive information.

Submit