+ + +
+PublishPress Blocks needs at least PHP 5.6.20 version, please update php before installing the plugin.
'; - } - } - - //Add actions - add_action('admin_init', 'advgb_disable_plugin'); - add_action('admin_notices', 'advgb_show_error'); - - //Do not load anything more - return; -} - if (!defined('GUTENBERG_VERSION_REQUIRED')) { define('GUTENBERG_VERSION_REQUIRED', '5.7.0'); } @@ -87,10 +50,13 @@ function advg_language_domain_init() if (! function_exists('advg_check_legacy_widget_block_init')) { /** - * v2.11.0 - Check if core/legacy-widget exists in current user role through advgb_blocks_user_roles option, + * Check if widget blocks exists in current user role through advgb_blocks_user_roles option, * either in inactive_blocks or active_blocks array. * https://github.com/publishpress/PublishPress-Blocks/issues/756#issuecomment-932358037 * + * @since 2.11.0 + * @since 3.1.4.2 - Added support for core/widget-group block + * * This function can be used in future to add new blocks not available on widgets.php * * @return void @@ -101,6 +67,11 @@ function advg_check_legacy_widget_block_init() return false; } + $widget_blocks = [ + 'core/legacy-widget', + 'core/widget-group' + ]; + global $wp_version; global $pagenow; if( ( $pagenow === 'widgets.php' || $pagenow === 'customize.php' ) && $wp_version >= 5.8 ) { @@ -112,19 +83,19 @@ function advg_check_legacy_widget_block_init() if( count( $advgb_blocks_list ) && count( $advgb_blocks_user_roles ) ) { - if( - is_array($advgb_blocks_user_roles[$current_user_role]['active_blocks']) - && is_array($advgb_blocks_user_roles[$current_user_role]['inactive_blocks']) - && !in_array( 'core/legacy-widget', $advgb_blocks_user_roles[$current_user_role]['active_blocks'] ) - && !in_array( 'core/legacy-widget', $advgb_blocks_user_roles[$current_user_role]['inactive_blocks'] ) - && !empty( $current_user_role ) - ) { - - array_push( - $advgb_blocks_user_roles[$current_user_role]['active_blocks'], - 'core/legacy-widget' - ); - update_option( 'advgb_blocks_user_roles', $advgb_blocks_user_roles, false ); + foreach( $widget_blocks as $item ) { + if( is_array( $advgb_blocks_user_roles[$current_user_role]['active_blocks'] ) + && is_array($advgb_blocks_user_roles[$current_user_role]['inactive_blocks'] ) + && ! in_array( $item, $advgb_blocks_user_roles[$current_user_role]['active_blocks'] ) + && ! in_array( $item, $advgb_blocks_user_roles[$current_user_role]['inactive_blocks'] ) + && ! empty( $current_user_role ) + ) { + array_push( + $advgb_blocks_user_roles[$current_user_role]['active_blocks'], + $item + ); + update_option( 'advgb_blocks_user_roles', $advgb_blocks_user_roles, false ); + } } } } diff --git a/src/readme.txt b/src/readme.txt index 9071e65f..6c627490 100644 --- a/src/readme.txt +++ b/src/readme.txt @@ -3,8 +3,8 @@ Contributors: publishpress, stevejburge, htmgarcia Tags: gutenberg, gutenberg blocks, gutenberg block, block editor, blocks, accordion block, gallery block, slider block, tabs block, maps block, block controls Requires at least: 5.0 Tested up to: 6.2 -Stable tag: 3.1.4.1 -Requires PHP: 5.6 +Stable tag: 3.1.4.2 +Requires PHP: 7.2.5 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html @@ -270,6 +270,11 @@ Yes, we use the phrase "publishpress-advg-install" to share install links. You w == Changelog == += 3.1.4.2 - 12 Apr 2023 = + * Fix: Allowed block types for non-saved block types in post edit + * Fix: Widget Group block type not saved as active + * Add: PHP 7.2.5 as minimum PHP version + = 3.1.4.1 - 29 Mar 2023 = * Fix: Blinking block inserter in WordPress 6.2 * Fix: Toggle to open calendar popup in Block controls