Changeset 3122238 for classic-editor
- Timestamp:
- 07/19/2024 06:01:58 PM (21 months ago)
- Location:
- classic-editor/trunk
- Files:
-
- 2 edited
-
classic-editor.php (modified) (7 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
classic-editor/trunk/classic-editor.php
r2889522 r3122238 58 58 // User settings. 59 59 add_action( 'personal_options_update', array( __CLASS__, 'save_user_settings' ) ); 60 add_action( 'edit_user_profile_update', array( __CLASS__, 'save_user_settings' ) ); 60 61 add_action( 'profile_personal_options', array( __CLASS__, 'user_settings' ) ); 62 add_action( 'edit_user_profile', array( __CLASS__, 'user_settings') ); 61 63 } 62 64 } … … 199 201 } 200 202 201 private static function get_settings( $refresh = 'no' ) {203 private static function get_settings( $refresh = 'no', $user_id = 0 ) { 202 204 /** 203 205 * Can be used to override the plugin's settings. Always hides the settings UI when used (as users cannot change the settings). … … 208 210 * 'allow-users' => false, 209 211 * 210 * @param boolean To override the settings return an array with the above keys. 212 * @param boolean To override the settings return an array with the above keys. Default false. 211 213 */ 212 214 $settings = apply_filters( 'classic_editor_plugin_settings', false ); … … 271 273 // Override the defaults with the user options. 272 274 if ( ( ! isset( $GLOBALS['pagenow'] ) || $GLOBALS['pagenow'] !== 'options-writing.php' ) && $allow_users ) { 273 $user_options = get_user_option( 'classic-editor-settings' ); 275 276 $user_options = get_user_option( 'classic-editor-settings', $user_id ); 274 277 275 278 if ( $user_options === 'block' || $user_options === 'classic' ) { … … 403 406 } 404 407 405 public static function settings_1( ) {406 $settings = self::get_settings( 'refresh' );408 public static function settings_1( $user_id = 0 ) { 409 $settings = self::get_settings( 'refresh', $user_id ); 407 410 408 411 ?> … … 447 450 * Shown on the Profile page when allowed by admin. 448 451 */ 449 public static function user_settings( ) {452 public static function user_settings( $user = null ) { 450 453 global $user_can_edit; 451 454 $settings = self::get_settings( 'update' ); 452 455 453 if ( 454 ! defined( 'IS_PROFILE_PAGE' ) || 455 ! IS_PROFILE_PAGE || 456 ! $user_can_edit || 457 ! $settings['allow-users'] 458 ) { 456 if ( ! $user_can_edit || ! $settings['allow-users'] ) { 459 457 return; 458 } 459 460 if ( $user instanceof WP_User ) { 461 $user_id = (int) $user->ID; 462 } else { 463 $user_id = 0; 460 464 } 461 465 … … 466 470 <td> 467 471 <?php wp_nonce_field( 'allow-user-settings', 'classic-editor-user-settings' ); ?> 468 <?php self::settings_1( ); ?>472 <?php self::settings_1( $user_id ); ?> 469 473 </td> 470 474 </tr> -
classic-editor/trunk/readme.txt
r3119645 r3122238 4 4 Requires at least: 4.9 5 5 Tested up to: 6.6 6 Stable tag: 1.6. 36 Stable tag: 1.6.4 7 7 Requires PHP: 5.2.4 8 8 License: GPLv2 or later … … 29 29 30 30 == Changelog == 31 32 = 1.6.4 = 33 * Added support for administrators to choose the default editor for other users. 31 34 32 35 = 1.6.3 =
Note: See TracChangeset
for help on using the changeset viewer.