plugin updates

This commit is contained in:
Tony Volpe
2024-07-22 09:27:59 -04:00
parent f13cad0e36
commit a903eec02d
2 changed files with 24 additions and 17 deletions

View File

@@ -5,7 +5,7 @@
* Plugin Name: Classic Editor
* Plugin URI: https://wordpress.org/plugins/classic-editor/
* Description: Enables the WordPress classic editor and the old-style Edit Post screen with TinyMCE, Meta Boxes, etc. Supports the older plugins that extend this screen.
* Version: 1.6.3
* Version: 1.6.4
* Author: WordPress Contributors
* Author URI: https://github.com/WordPress/classic-editor/
* License: GPLv2 or later
@@ -57,7 +57,9 @@ class Classic_Editor {
if ( $settings['allow-users'] ) {
// User settings.
add_action( 'personal_options_update', array( __CLASS__, 'save_user_settings' ) );
add_action( 'edit_user_profile_update', array( __CLASS__, 'save_user_settings' ) );
add_action( 'profile_personal_options', array( __CLASS__, 'user_settings' ) );
add_action( 'edit_user_profile', array( __CLASS__, 'user_settings') );
}
}
@@ -198,7 +200,7 @@ class Classic_Editor {
}
private static function get_settings( $refresh = 'no' ) {
private static function get_settings( $refresh = 'no', $user_id = 0 ) {
/**
* Can be used to override the plugin's settings. Always hides the settings UI when used (as users cannot change the settings).
*
@@ -207,7 +209,7 @@ class Classic_Editor {
* 'editor' => 'classic', // Accepted values: 'classic', 'block'.
* 'allow-users' => false,
*
* @param boolean To override the settings return an array with the above keys.
* @param boolean To override the settings return an array with the above keys. Default false.
*/
$settings = apply_filters( 'classic_editor_plugin_settings', false );
@@ -270,7 +272,8 @@ class Classic_Editor {
// Override the defaults with the user options.
if ( ( ! isset( $GLOBALS['pagenow'] ) || $GLOBALS['pagenow'] !== 'options-writing.php' ) && $allow_users ) {
$user_options = get_user_option( 'classic-editor-settings' );
$user_options = get_user_option( 'classic-editor-settings', $user_id );
if ( $user_options === 'block' || $user_options === 'classic' ) {
$editor = $user_options;
@@ -402,8 +405,8 @@ class Classic_Editor {
return 'disallow';
}
public static function settings_1() {
$settings = self::get_settings( 'refresh' );
public static function settings_1( $user_id = 0 ) {
$settings = self::get_settings( 'refresh', $user_id );
?>
<div class="classic-editor-options">
@@ -446,18 +449,19 @@ class Classic_Editor {
/**
* Shown on the Profile page when allowed by admin.
*/
public static function user_settings() {
public static function user_settings( $user = null ) {
global $user_can_edit;
$settings = self::get_settings( 'update' );
if (
! defined( 'IS_PROFILE_PAGE' ) ||
! IS_PROFILE_PAGE ||
! $user_can_edit ||
! $settings['allow-users']
) {
if ( ! $user_can_edit || ! $settings['allow-users'] ) {
return;
}
if ( $user instanceof WP_User ) {
$user_id = (int) $user->ID;
} else {
$user_id = 0;
}
?>
<table class="form-table">
@@ -465,7 +469,7 @@ class Classic_Editor {
<th scope="row"><?php _e( 'Default Editor', 'classic-editor' ); ?></th>
<td>
<?php wp_nonce_field( 'allow-user-settings', 'classic-editor-user-settings' ); ?>
<?php self::settings_1(); ?>
<?php self::settings_1( $user_id ); ?>
</td>
</tr>
</table>

View File

@@ -1,9 +1,9 @@
=== Classic Editor ===
Contributors: wordpressdotorg, azaozz, melchoyce, chanthaboune, alexislloyd, pento, youknowriad, desrosj, luciano-croce
Contributors: wordpressdotorg, azaozz, melchoyce, chanthaboune, alexislloyd, pento, youknowriad, desrosj, luciano-croce, ironprogrammer
Tags: gutenberg, disable, disable gutenberg, editor, classic editor, block editor
Requires at least: 4.9
Tested up to: 6.2
Stable tag: 1.6.3
Tested up to: 6.6
Stable tag: 1.6.4
Requires PHP: 5.2.4
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -29,6 +29,9 @@ By default, this plugin hides all functionality available in the new block edito
== Changelog ==
= 1.6.4 =
* Added support for administrators to choose the default editor for other users.
= 1.6.3 =
* Added some WPCS fixes, props NicktheGeek on GitHub.
* Updated "Tested up to" in the readme and removed it from classic-editor.php. This should fix false positive errors in security plugins in the future.