Make WordPress Core


Ignore:
Timestamp:
04/13/2018 05:55:25 PM (8 years ago)
Author:
azaozz
Message:

Privacy: improve the screen for setting a privacy policy page.

Props melchoyce, xkon, azaozz.
See #43435.

File:
1 edited

Legend:

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

    r42823 r42978  
    2929                        'page_for_privacy_policy',
    3030                        'page_for_privacy_policy',
    31                         __( 'Privacy policy page updated successfully.' ),
     31                        sprintf(
     32                                // translators: URL to Customizer -> Menus
     33                                __( 'Privacy policy page updated successfully. Remember to <a href="%s">update your menus</a>!' ),
     34                                'customize.php?autofocus[panel]=nav_menus'
     35                        ),
    3236                        'updated'
    3337                );
     
    5155                } else {
    5256                        update_option( 'wp_page_for_privacy_policy', $privacy_policy_page_id );
     57
    5358                        add_settings_error(
    5459                                'page_for_privacy_policy',
    5560                                'page_for_privacy_policy',
    56                                 __( 'Privacy policy page created successfully.' ),
     61                                sprintf(
     62                                        // translators: URL to edit Privacy Policy page
     63                                        __( 'Your Privacy Policy page created successfully. You&#8217;ll want to <a href="%s">review and edit your policy</a> next.' ),
     64                                        'post.php?post=' . $privacy_policy_page_id . '&action=edit'
     65                                ),
    5766                                'updated'
    5867                        );
     
    6372// If a privacy policy page ID is available, make sure the page actually exists. If not, display an error.
    6473$privacy_policy_page_exists = false;
    65 $privacy_policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' );
     74$privacy_policy_page_id     = (int) get_option( 'wp_page_for_privacy_policy' );
    6675
    6776if ( ! empty( $privacy_policy_page_id ) ) {
    68                 $privacy_policy_page = get_post( $privacy_policy_page_id );
    69                 if ( ! $privacy_policy_page instanceof WP_Post ) {
     77
     78        $privacy_policy_page = get_post( $privacy_policy_page_id );
     79
     80        if ( ! $privacy_policy_page instanceof WP_Post ) {
     81                add_settings_error(
     82                        'page_for_privacy_policy',
     83                        'page_for_privacy_policy',
     84                        __( 'The currently selected privacy policy page does not exist. Please create or select new page.' ),
     85                        'error'
     86                );
     87        } else {
     88                if ( 'trash' === $privacy_policy_page->post_status ) {
    7089                        add_settings_error(
    7190                                'page_for_privacy_policy',
    7291                                'page_for_privacy_policy',
    73                                 __( 'The currently selected privacy policy page does not exist. Please create or select new page.' ),
     92                                sprintf(
     93                                        // translators: URL to Pages Trash.
     94                                        __( 'The currently selected privacy policy page is in the trash. Please create or select new privacy policy page or <a href="%s">restore the current page</a>.' ),
     95                                        'edit.php?post_status=trash&post_type=page'
     96                                ),
    7497                                'error'
    7598                        );
    7699                } else {
    77                         if ( 'trash' === $privacy_policy_page->post_status ) {
    78                                 add_settings_error(
    79                                         'page_for_privacy_policy',
    80                                         'page_for_privacy_policy',
    81                                         sprintf(
    82                                                 __( 'The currently selected privacy policy page is in the trash. Please create or select new privacy policy page or <a href="%s">restore the current page</a>.' ),
    83                                                 'edit.php?post_status=trash&post_type=page'
    84                                         ),
    85                                         'error'
    86                                 );
    87                         } else {
    88                                 $privacy_policy_page_exists = true;
    89                         }
     100                        $privacy_policy_page_exists = true;
    90101                }
     102        }
    91103}
    92104
     
    94106        'id'      => 'privacy',
    95107        'title'   => __( 'Privacy' ),
    96         'content' => '<p>' . __( 'This page provides tools with which you can manage your user\'s personal data and site\'s privacy policy.' ) . '</p>',
     108        'content' => '<p>' . __( 'This page provides tools with which you can manage your user&#8217;s personal data and site&#8217;s privacy policy.' ) . '</p>',
    97109) );
    98110
     
    108120        <h1><?php _e( 'Privacy Tools' ); ?></h1>
    109121        <?php settings_errors(); ?>
    110 
    111         <h2><?php _e( 'Privacy policy page' ); ?></h2>
    112 
     122        <h2><?php _e( 'Privacy Policy page' ); ?></h2>
     123        <p>
     124                <?php _e( 'The first step towards privacy laws compliance is to have a comprehensive Privacy Policy.' ); ?>
     125                <?php _e( 'If you already have a Privacy Policy page, please select it below. If not, create one.' ); ?>
     126                <?php _e( 'The new policy will include the suggested privacy text.' ); ?>
     127        </p>
     128        <p>
     129                <?php _e( 'After your Privacy Policy page is set, we suggest that you edit it.' ); ?>
     130                <?php _e( 'On the edit page screen you will find additional privacy information added by your plugins.' ); ?>
     131                <?php _e( 'We would also suggest reviewing your privacy policy from time to time, after a WordPress or a plugin update.' ); ?>
     132                <?php _e( 'There may be changes or new suggested information for you to consider adding to your policy.' ); ?>
     133        </p>
    113134        <?php
    114135        if ( $privacy_policy_page_exists ) {
    115136                $edit_href = add_query_arg(
    116137                        array(
    117                                 'post'  => $privacy_policy_page_id,
     138                                'post'   => $privacy_policy_page_id,
    118139                                'action' => 'edit',
    119140                        ),
    120141                        admin_url( 'post.php' )
    121142                );
     143
    122144                $view_href = get_permalink( $privacy_policy_page_id );
    123 
    124145                ?>
    125                 <p><strong>
     146                <p class="tools-privacy-edit"><strong>
    126147                        <?php
    127148                        printf(
    128                                 __( '<a href="%1$s">Edit</a> or <a href="%2$s">view</a> your privacy policy.' ),
     149                                // translators: %1$s URL to Edit Page, %2$s URL to View Page
     150                                __( '<a href="%1$s">Edit</a> or <a href="%2$s">view</a> your privacy policy page content.' ),
    129151                                $edit_href,
    130152                                $view_href
     
    135157        }
    136158        ?>
    137 
    138         <table class="form-table">
     159        <hr>
     160        <table class="form-table tools-privacy-policy-page">
    139161                <tr>
    140162                        <th scope="row">
    141                                 <label for="page_for_privacy_policy">
    142                                         <?php
    143 
    144                                         if ( $privacy_policy_page_exists ) {
    145                                                 _e( 'Select another page for your privacy policy' );
    146                                         } else {
    147                                                 _e( 'Select an existing privacy policy page' );
    148                                         }
    149 
    150                                         ?>
    151                                 </label>
     163                                <?php
     164                                if ( $privacy_policy_page_exists ) {
     165                                        _e( 'Change your Privacy Policy page' );
     166                                } else {
     167                                        _e( 'Select a Privacy Policy page' );
     168                                }
     169                                ?>
    152170                        </th>
    153                         <td id="front-static-pages">
     171                        <td>
    154172                                <form method="post" action="">
     173                                        <label for="page_for_privacy_policy">
     174                                                <?php _e( 'Either select an existing page:' ); ?>
     175                                        </label>
    155176                                        <input type="hidden" name="action" value="set-privacy-page" />
    156177                                        <?php
    157 
    158178                                        wp_dropdown_pages(
    159179                                                array(
     
    167187
    168188                                        wp_nonce_field( 'set-privacy-page' );
    169                                         submit_button( __( 'Set Page' ), 'primary', 'submit', true, array( 'id' => 'set-page' ) );
    170 
     189
     190                                        submit_button( __( 'Use This Page' ), 'primary', 'submit', false, array( 'id' => 'set-page' ) );
     191                                        ?>
     192                                </form>
     193
     194                                <form method="post" action="">
     195                                        <input type="hidden" name="action" value="create-privacy-page" />
     196                                        <span>
     197                                                <?php _e( 'Or create a new page: ' ); ?>
     198                                        </span>
     199                                        <?php
     200                                        wp_nonce_field( 'create-privacy-page' );
     201       
     202                                        submit_button( __( 'Create New Page' ), 'primary', 'submit', false, array( 'id' => 'create-page' ) );
    171203                                        ?>
    172204                                </form>
    173205                        </td>
    174206                </tr>
    175                 <?php
    176 
    177                 if ( ! $privacy_policy_page_exists ) {
    178                         ?>
    179                         <tr>
    180                                 <th scope="row"><?php _e( 'Create new page for your privacy policy' ); ?></th>
    181                                 <td>
    182                                         <form method="post" action="">
    183                                                 <input type="hidden" name="action" value="create-privacy-page" />
    184                                                 <?php
    185 
    186                                                 wp_nonce_field( 'create-privacy-page' );
    187                                                 submit_button( __( 'Create Page' ), 'primary', 'submit', true, array( 'id' => 'create-page' ) );
    188 
    189                                                 ?>
    190                                         </form>
    191                                 </td>
    192                         </tr>
    193                         <?php
    194                 }
    195 
    196                 ?>
    197207        </table>
    198208</div>
    199 
    200209<?php
    201210
Note: See TracChangeset for help on using the changeset viewer.