Skip to content

Commit

Permalink
#23
Browse files Browse the repository at this point in the history
  • Loading branch information
Hube2 committed Feb 26, 2023
1 parent 1831a7f commit a039851
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
8 changes: 4 additions & 4 deletions acf-user-role-field-setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Plugin Name: ACF User Role Field Setting
Plugin URI: https://wordpress.org/plugins/user-role-field-setting-for-acf/
Description: Set user types that should be allowed to edit fields
Version: 4.0.0
Version: 4.0.1
Author: John A. Huebner II
Author URI: https://github.com/Hube2/
License: GPL
Expand Down Expand Up @@ -44,7 +44,7 @@ public function after_setup_theme() {

private function user_can_edit($field) {
$exclude = apply_filters('acf/user_role_setting/exclude_field_types', $this->exclude_field_types);
if (in_array($field['type'], $exclude)) {
if (is_array($exclude) && in_array($field['type'], $exclude)) {
return true;
}
if (isset($field['user_roles'])) {
Expand Down Expand Up @@ -113,15 +113,15 @@ public function add_actions() {
if (version_compare($acf_version, '5.6.0', '>=') && version_compare($acf_version, '5.7.0', '<')) {
foreach ($sections as $section) {
foreach ($section as $type => $label) {
if (!isset($exclude[$type])) {
if (empty($exclude[$type])) {
add_action('acf/render_field_settings/type='.$type, array($this, 'render_field_settings'), 1);
}
}
}
} else {
// >= 5.5.0 || < 5.6.0
foreach ($sections as $type => $settings) {
if (!isset($exclude[$type])) {
if (!empty($exclude[$type])) {
add_action('acf/render_field_settings/type='.$type, array($this, 'render_field_settings'), 1);
}
}
Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: Hube2
Tags: acf, advanced custom fields, user role, setting, security, multisite
Requires at least: 4.0
Tested up to: 5.5
Stable tag: 4.0.0
Stable tag: 4.0.1
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -78,6 +78,9 @@ There is a filter so that you can adjust the types of fields that are excluded.

== Changelog ==

= 4.0.1 =
* Validate exlcuded field types from filter is an array to prevent errors do to user filter rerurning invalid value.

= 4.0.0 =
* Removed support for repeater sub fields
* Various bug fixes
Expand Down

0 comments on commit a039851

Please sign in to comment.