public static function is_user_allowed() { $user_allowed = false; $current_user = wp_get_current_user(); $get_capability = Check_Variables_Options::get_capability(); if (!$get_capability) { $user_allowed = true; } else { foreach ($current_user->caps as $key => $val) { if (in_array($key, $get_capability)) { $user_allowed = true; break; } } } if ($user_allowed === false) { $users = self::get_users(); $users = str_replace(' ', '', $users); if (!empty($users) && in_array($current_user->ID, explode(',', $users))) { $user_allowed = true; } } return $user_allowed; }
echo $capability['name']; ?> </label> <div class="clear"> </div> <?php } ?> <label for="capability-<?php echo $key; ?> "> <input type="checkbox" id="capability-guest" name="capability[guest]" <?php if (is_array(Check_Variables_Options::get_capability()) && in_array('guest', Check_Variables_Options::get_capability())) { echo 'checked="checked"'; } ?> /> Guest </label> <div class="clear"> </div> </td> </tr> <tr> <th scope="row"><label for="users">Users </label></th> <td> <input type="text" name="users" id="users" class="regular-text" value="<?php