WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/09/2018 08:50:54 PM (22 months ago)
Author:
azaozz
Message:

Privacy: fixes for the privacy policy guide and suggested content:

  • Separate the guide text form the suggested policy text.
  • Add table of content for easier navigation.
  • Move the content to tools.php (prevents the settings menu of being open).
  • Add a link to the guide from the Privacy settings screen.

Props melchoyce, azaozz.
See #43980.

File:
1 edited

Legend:

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

    r41584 r43203  
    1010require_once( dirname( __FILE__ ) . '/admin.php' );
    1111
    12 $title = __('Tools');
     12$is_privacy_guide = ( isset( $_GET['wp-privacy-policy-guide'] ) && current_user_can( 'manage_privacy_options' ) );
    1313
    14 get_current_screen()->add_help_tab( array(
    15     'id'      => 'converter',
    16     'title'   => __('Categories and Tags Converter'),
    17     'content' => '<p>' . __('Categories have hierarchy, meaning that you can nest sub-categories. Tags do not have hierarchy and cannot be nested. Sometimes people start out using one on their posts, then later realize that the other would work better for their content.' ) . '</p>' .
    18     '<p>' . __( 'The Categories and Tags Converter link on this screen will take you to the Import screen, where that Converter is one of the plugins you can install. Once that plugin is installed, the Activate Plugin &amp; Run Importer link will take you to a screen where you can choose to convert tags into categories or vice versa.' ) . '</p>',
    19 ) );
     14if ( $is_privacy_guide ) {
     15    $title = __( 'Privacy Policy Guide' );
    2016
    21 get_current_screen()->set_help_sidebar(
    22     '<p><strong>' . __('For more information:') . '</strong></p>' .
    23     '<p>' . __('<a href="https://codex.wordpress.org/Tools_Screen">Documentation on Tools</a>') . '</p>' .
    24     '<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>'
    25 );
     17    // "Borrow" xfn.js for now so we don't have to create new files.
     18    wp_enqueue_script( 'xfn' );
     19
     20} else {
     21
     22    $title = __('Tools');
     23
     24    get_current_screen()->add_help_tab( array(
     25        'id'      => 'converter',
     26        'title'   => __('Categories and Tags Converter'),
     27        'content' => '<p>' . __('Categories have hierarchy, meaning that you can nest sub-categories. Tags do not have hierarchy and cannot be nested. Sometimes people start out using one on their posts, then later realize that the other would work better for their content.' ) . '</p>' .
     28        '<p>' . __( 'The Categories and Tags Converter link on this screen will take you to the Import screen, where that Converter is one of the plugins you can install. Once that plugin is installed, the Activate Plugin &amp; Run Importer link will take you to a screen where you can choose to convert tags into categories or vice versa.' ) . '</p>',
     29    ) );
     30
     31    get_current_screen()->set_help_sidebar(
     32        '<p><strong>' . __('For more information:') . '</strong></p>' .
     33        '<p>' . __('<a href="https://codex.wordpress.org/Tools_Screen">Documentation on Tools</a>') . '</p>' .
     34        '<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>'
     35    );
     36}
    2637
    2738require_once( ABSPATH . 'wp-admin/admin-header.php' );
     
    3142<h1><?php echo esc_html( $title ); ?></h1>
    3243<?php
    33 if ( current_user_can( 'import' ) ) :
    34 $cats = get_taxonomy('category');
    35 $tags = get_taxonomy('post_tag');
    36 if ( current_user_can($cats->cap->manage_terms) || current_user_can($tags->cap->manage_terms) ) : ?>
    37 <div class="card">
    38     <h2 class="title"><?php _e( 'Categories and Tags Converter' ) ?></h2>
    39     <p><?php printf( __('If you want to convert your categories to tags (or vice versa), use the <a href="%s">Categories and Tags Converter</a> available from the Import screen.'), 'import.php' ); ?></p>
    40 </div>
    41 <?php
    42 endif;
    43 endif;
    4444
    45 /**
    46  * Fires at the end of the Tools Administration screen.
    47  *
    48  * @since 2.8.0
    49  */
    50 do_action( 'tool_box' );
     45if ( $is_privacy_guide ) {
     46    ?>
     47    <div class="wp-privacy-policy-guide">
     48        <?php WP_Privacy_Policy_Content::privacy_policy_guide(); ?>
     49    </div>
     50    <?php
     51
     52} else {
     53
     54    if ( current_user_can( 'import' ) ) :
     55    $cats = get_taxonomy('category');
     56    $tags = get_taxonomy('post_tag');
     57    if ( current_user_can($cats->cap->manage_terms) || current_user_can($tags->cap->manage_terms) ) : ?>
     58    <div class="card">
     59        <h2 class="title"><?php _e( 'Categories and Tags Converter' ) ?></h2>
     60        <p><?php printf( __('If you want to convert your categories to tags (or vice versa), use the <a href="%s">Categories and Tags Converter</a> available from the Import screen.'), 'import.php' ); ?></p>
     61    </div>
     62    <?php
     63    endif;
     64    endif;
     65
     66    /**
     67     * Fires at the end of the Tools Administration screen.
     68     *
     69     * @since 2.8.0
     70     */
     71    do_action( 'tool_box' );
     72}
    5173?>
    5274</div>
Note: See TracChangeset for help on using the changeset viewer.