Plugin Directory

Changeset 1033497


Ignore:
Timestamp:
11/27/2014 01:17:37 AM (11 years ago)
Author:
arippberger
Message:

Fixed bug where errors display if settings not entered

File:
1 edited

Legend:

Unmodified
Added
Removed
  • super-simple-post-page-restricor/trunk/super-simple-post-page-restrictor.php

    r951353 r1033497  
    44Plugin URI: https://github.com/arippberger/super-simple-post-page-restrictor
    55Description: Adds a super simple post / page restriction option
    6 Version: 1.0
     6Version: 1.1
    77Author: arippberger
    88Author URI: http://alecrippberger.com
     
    9393
    9494            //loop through current user roles and check if any roles are in restricted roles array
    95             foreach ($current_user_roles as $key => $role) {
    96                 if ( in_array( $role, $restricted_roles) ) {
    97                     //restrict access
    98                     $current_user_can_access = false;
     95            if ( is_array( $current_user_roles ) ) { //first check if is array (settings need to be set)
     96                foreach ($current_user_roles as $key => $role) {
     97                    if ( is_array( $restricted_roles ) && in_array( $role, $restricted_roles) ) { //if restricted roles is set (is_array()) and current role is in restricted roles
     98                        //restrict access
     99                        $current_user_can_access = false;
     100                    }
    99101                }
    100102            }
Note: See TracChangeset for help on using the changeset viewer.