• Resolved Arjan

    (@a4net)


    The role restriction always gives true.
    Reproduce:
    Limit quiz-maker to a specific role (say admin)
    Login with a user having a different role (say editor)
    De editor user still has access to Quiz Maker

    Cause:
    The function quiz_maker_capabilities incorrectly checks for the user’s role.

    
    foreach($current_user_roles as $r){
        if(in_array($r, $ays_user_roles)){
            $ishmar++;
        }
    }

    The $ays_user_roles contains an array with the role names as Keys and value = true.
    Fix:

    
    foreach($current_user_roles as $key => $r){
        if(isset($ays_user_roles[$key])){
            $ishmar++;
        }
    }
Viewing 1 replies (of 1 total)
  • Plugin Author ays-pro

    (@ays-pro)

    Hi @a4net ,

    Thank you for the topic.

    We have tested that part in the plugin and it works properly.
    Your mentioned code part will not work for all cases (there are some cases when the $key is not the same, user has multiple user roles).

    Have you checked the editor access on the dashboard, this option is for restriction user roles in the dashboard (not front end)?

    As long as this option is available only in the Pro version, please contact us via this form for premium support.

    Commercial products are not supported in these forums.

Viewing 1 replies (of 1 total)
  • The topic ‘Roles restriction not working’ is closed to new replies.