WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/05/2017 04:24:52 AM (3 years ago)
Author:
helen
Message:

File Editors: Introduce an interstitial warning upon first visit.

This is an effort to provide a speed bump before heading into something potentially destructive and some education for users on better alternatives, even as we make the file editors safer to use. Each user, including existing users, will be shown a one-time dismissible modal warning on their first visit to each of the theme and plugin file editors.

Copy tweaks to come.

props michelleweber, Ipstenu, melchoyce, adamsilverstein, westonruter, toddnestor, aryamaaru, ZaneMatthew, cliffseal, helen.
fixes #31779.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/plugin-editor.php

    r41721 r41774  
    143143    wp_enqueue_script( 'wp-theme-plugin-editor' );
    144144    wp_add_inline_script( 'wp-theme-plugin-editor', sprintf( 'jQuery( function( $ ) { wp.themePluginEditor.init( $( "#template" ), %s ); } )', wp_json_encode( $settings ) ) );
     145    wp_add_inline_script( 'wp-theme-plugin-editor', sprintf( 'wp.themePluginEditor.themeOrPlugin = "plugin";' ) );
    145146
    146147    require_once(ABSPATH . 'wp-admin/admin-header.php');
     
    281282</div>
    282283<?php
     284$dismissed_pointers = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );
     285if ( ! in_array( 'plugin_editor_notice', $dismissed_pointers, true ) ) :
     286?>
     287<div id="file-editor-warning" class="notification-dialog-wrap file-editor-warning hide-if-no-js">
     288    <div class="notification-dialog-background"></div>
     289    <div class="notification-dialog" role="dialog" aria-labelledby="file-editor-warning-title" tabindex="0">
     290        <div class="file-editor-warning-content">
     291            <h1 id="file-editor-warning-title"><?php _e( 'Heads up!' ); ?></h1>
     292            <p><?php _e( 'You appear to be making direct edits to your plugin in the WordPress dashboard. We recommend that you don&#8217;t! Editing plugins directly may introduce incompatibilities that break your theme or other plugins, and can leave you unable to log back in to WordPress and undo changes.' ); ?></p>
     293            <p><?php _e( 'If you absolutely have to edit this plugin, create a copy with a new name and hang on to the original version, so you can re-enable a functional version if something goes wrong.' ); ?></p>
     294            <p><button type="button" class="file-editor-warning-dismiss button-primary"><?php _e( 'I understand' ); ?></button></p>
     295        </div>
     296    </div>
     297</div>
     298<?php
     299endif; // editor warning notice
    283300
    284301include(ABSPATH . "wp-admin/admin-footer.php");
Note: See TracChangeset for help on using the changeset viewer.