Can specific user roles be adjusted to give access to …
Can specific user roles be adjusted to give access to HD Quiz to others besides administrator?
This thread has been imported from harmonicdesign.ca/hd-quiz/
Hello Cory,this is definitely possible, but you’d need to make a small edit to a file in HD Quiz. How comfortable are you with doing this?
I can easily edit the file – If I know what to change. I noticed Admin and Editor currently have access. We have a role call ‘Correspondent’ – that we would like to give access too.
Unfortunately, WordPress doesn’t deal with permissions that easily. I wish it was as simple as adding “Correspondent” as an allowed role, but WordPress bases access based on capabilities, and each custom role has access to certain capabilities.
Please see here for more info: https://codex.wordpress.org…
So basically, what you’ll need to do is edit index.php and find the function called register_HD_questionnaire_admin()
. You’ll then want to edit the parameter of manage_options
to something that your Correspondent role also has access to.
By default, only Admins and Editors can “manage_options”. For example, If you wanted Authors to also have access, you can change it to “publish_posts”. “read” would allow all roles to have access.
Make sense! – I will give it a whirl!! Thanks for your quick replies. Very much appropriated.
Kinda worked – but only added the menu item and about/options – no add quiz or add questions.
Also tried ‘publish_post’ – same issue – only show ‘About / Options’ option in menu
Hi there,I forgot that we also need to edit the custom post type.
Please edit custom-meta.php
and near the end of post_type_HD_Questions()
change capability_type
from “page” to post
.
This will enable questions. But we now need to also enable the custom taxonomy.
Now find the function function custom_taxonomy_Quiz()
and add the following above $args = array(
.
$capabilities = array('manage_terms' => 'edit_posts','edit_terms' => 'edit_posts','delete_terms' => 'edit_posts','assign_terms' => 'edit_posts',);
now in the args
array, underneath 'rewrite' => false,
add 'capabilities' => $capabilities,
Now users that can edit posts will be able to add new questions and add/edit quizzes.
I fully understand if this is too hard to figure out. If you have trouble, just let me know and I can send you the full custom edits.
If you are enjoying HD Quiz please leave a review here on the official WordPress.org page. HD Quiz is developed by me, just some dude, and is supported and available for free. It may seem dumb, but truly nothing makes me happier than knowing that people are using and loving HD Quiz and my hard work.
This thread has either been marked as complete or has been automatically closed due to inactivity.