Access to Quiz Results
Hello,
I’m using HD Quiz with Save Results Pro. Another WordPress user was able to view the quiz results until the latest update. Now they can no longer access the results.
I don’t want to give them full Administrator access. What role or capabilities do I need to restore their access?
Thank you!
Additionally, in HD Quiz → Results → Settings, I cannot switch between the Form, Email, Leaderboard, Export, Integrations, Certificates, and Support tabs.
Hi Sergey,
yes, the recent version tightened up the access permissions to only admins. I’m guessing your other user is an editor?
I added in a new permissions filter in order to override this. You will need to download the new version (can be grabbed from your account page)
Once done, you will need to add the following code to your theme’s `functions.php` file. BACKUP THE FILE FIRST.
apply_filters('hdq_srp_capability', function () {
return 'manage_options';
});
manage_options will allow editors to access the results page.
You can view the WordPress capabilities page to view other options depending on the role you want to allow access to: https://wordpress.org/documentation/article/roles-and-capabilities/
Let me know if for whatever reason you are unable or unwilling to edit your theme’s functions.php file and I can package this as a plugin for you instead.
I was able to fix the initial access issue by adding the manage_options permission directly to the user role using User Role Editor without editing functions.php
However, I’m still having an issue in HD Quiz → Results → Settings. I cannot switch between the following tabs:
Form
Email
Leaderboard
Export
Integrations
Certificates
Support
Hi Sergey,
I cannot recommend modifying a user’s permissions to grant them that capability. You’ve just given all users with that role direct control over your options table.
With my recommendation, it would grant them access to the results page as the only additional thing. Zero permission spillover for anything outside of HD Quiz.
For the other issue, please upgrade to the recent version and clear your browser cache after. That should fix the tabs for you.
I’ve installed the latest version, 1.9.5, and added the following to my theme’s functions.php file:
apply_filters('hdq_srp_capability', function () {
return 'manage_options';
});
The user is assigned the Editor role, but they still don’t have access to the Results page. They can access HD Quiz and Addons, but Results is still unavailable.
Sorry about this; I didn’t communitate well.
manage_options is the default required capability for accessing the results, and is a capability reserved for Admins. Since you are looking for Editors to have access, we need to change the capability to something that editors have to such as edit_others_posts.
Here is the direct WordPress documenation on this: https://wordpress.org/documentation/article/roles-and-capabilities/#editor
TLDR: Change manage_options to edit_others_posts