1

Wp pro quiz has no option to let other user roles to add and edit quizzes and questions other than admin.

In the lib/helper/WpProQuiz_Helper_Upgrade.php I saw this code,

 private static function install()
{
    $role = get_role('administrator');

    $role->add_cap('wpProQuiz_show');
    $role->add_cap('wpProQuiz_add_quiz');
    $role->add_cap('wpProQuiz_edit_quiz');
    $role->add_cap('wpProQuiz_delete_quiz');
    $role->add_cap('wpProQuiz_show_statistics');
    $role->add_cap('wpProQuiz_reset_statistics');
    $role->add_cap('wpProQuiz_import');
    $role->add_cap('wpProQuiz_export');
    $role->add_cap('wpProQuiz_change_settings');
    $role->add_cap('wpProQuiz_toplist_edit');

    //ACHIEVEMENTS Version 2.x.x
    if (defined('ACHIEVEMENTS_IS_INSTALLED') && ACHIEVEMENTS_IS_INSTALLED === 1 && defined('ACHIEVEMENTS_VERSION')) {
        $version = ACHIEVEMENTS_VERSION;
        if ($version{0} == '2') {
            WpProQuiz_Plugin_BpAchievementsV2::install();
        }
    }
} 
  private static function updateV19()
{
    $role = get_role('administrator');

    $role->add_cap('wpProQuiz_toplist_edit');
}

So, I decided to replace 'administrator' with 'author' to let the author roles to use this plugin.

But it didn't work. Do i need to do anything further.

1 Answer 1

0

A much more efficient way that doesn't require editing the source code:

install and activate wpfront User role editor,

go to all roles,

edit the author role,

scroll down to the 'other capabilities' section,

check the following capabilities: wpProQuiz_show, wpProQuiz_add_quiz, wpProQuiz_edit_quiz Save.

The authors on your site should now be able to add and edit quizes.

3
  • I do this , but users can see all quiz , and can edit other user quiz!! can change this? any user should see his quiz only
    – hojjat.mi
    Apr 11, 2020 at 5:11
  • You do not have to add all the options suggested above. Play with them and use only the options that give you what you want. Apr 11, 2020 at 19:05
  • options suggested above just show wpproquiz in menu , but not set permission on quizzes. for example user a create quiz. user b after login see all quiz !!!! it means user b can edit or delete user a quiz.
    – hojjat.mi
    Apr 12, 2020 at 3:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.