PluginProbe
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF / trunk
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF vtrunk
2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.9 2.2.8 trunk 1.10 1.3.3 1.3.4 1.3.5 1.3.5.1 1.3.5.2 1.3.6 1.3.6.1 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.5 All 103 releases
← All changes | inc/3rd-party/nextgen-gallery/classes/Context/NGG.php +20 -0 2.2.8 → trunk View file →
@@ -107,7 +107,27 @@
107 107 default:
108 108 $capacity = $describer;
109 109 }
110 110
111 + // NGG v4 may not register the v3 custom capabilities. Fall back to 'manage_options' so
112 + // the submenu and bulk page remain accessible to site administrators on v4.
113 + // @codeCoverageIgnoreStart — requires live NGG v4 class; not available in unit tests.
114 + if ( class_exists( 'Imagely\NGG\Admin\App' ) && ! get_role( $capacity ) && ! wp_roles()->is_role( $capacity ) ) {
115 + $wp_roles = wp_roles();
116 + $has_cap = false;
117 +
118 + foreach ( $wp_roles->roles as $role_data ) {
119 + if ( ! empty( $role_data['capabilities'][ $capacity ] ) ) {
120 + $has_cap = true;
121 + break;
122 + }
123 + }
124 +
125 + if ( ! $has_cap ) {
126 + $capacity = 'manage_options';
127 + }
128 + }
129 + // @codeCoverageIgnoreEnd
130 +
111 131 return $this->filter_capacity( $capacity, $describer );
112 132 }
113 133 }