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

Sorry for the long silence, things got complicated for a while. Thank you for the detailed explanation.

I’ll keep editing the files locally for now.

My client’s use case is they are a not-for-profit media and they have several editors, all of whom need to be able to add and edit quizzes, no matter which of them created those quizzes. We can’t assign admin rights to the editors, and we don’t want to grant authors and below any rights to the quizzes.

19 January 2025 β€” 13:47 thread author - Paulo

If you’re using the latest version, this might have already been solved for you πŸ™‚

19 January 2025 β€” 13:49 support admin - Dylan

Additionally (and possibly a different issue), we’ve noticed the ‘quizzes’ menu item in the question editor was gone for all roles.

The quizzes on the site are all single-question multiple-answer types. It’s actually always the same quiz where the question is changed periodically. We also keep an unpublished quiz as an archive for previous questions to be able to reuse them when needed. We were able to reassign a current question to the archive quiz from within the editor, but now we only have the Main and Extra menu options there.

We’re now using a direct link to the question list it the default WP table view at /wp-admin/edit.php?post_type=post_type_questionna.

Could that be a result of my messing with the permissions in the plugin functions?

19 January 2025 β€” 14:03 thread author - Paulo

> If you’re using the latest version, this might have already been solved for you

Wow! Thank you! I’ll check that.

19 January 2025 β€” 14:30 thread author - Paulo

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