Make WordPress Core

Changeset 42170 for branches/4.9


Ignore:
Timestamp:
11/13/2017 07:25:23 PM (7 years ago)
Author:
westonruter
Message:

Customize: Prevent PHP notice on theme-switch dashboard welcome link (and link to themes admin screen) when user cannot customize.

Props skostadinov, ocean90.
Amends [41699].
See #42050.
Fixes #42525 for 4.9.

Location:
branches/4.9
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.9

  • branches/4.9/src/wp-admin/includes/dashboard.php

    r41978 r42170  
    15681568    <div class="welcome-panel-column-container">
    15691569    <div class="welcome-panel-column">
    1570         <?php if ( current_user_can( 'customize' ) ):
    1571             $customize_themes_link = add_query_arg( 'autofocus[panel]', 'themes', admin_url( 'customize.php' ) ); ?>
     1570        <?php if ( current_user_can( 'customize' ) ) : ?>
    15721571            <h3><?php _e( 'Get Started' ); ?></h3>
    15731572            <a class="button button-primary button-hero load-customize hide-if-no-customize" href="<?php echo wp_customize_url(); ?>"><?php _e( 'Customize Your Site' ); ?></a>
     
    15751574        <a class="button button-primary button-hero hide-if-customize" href="<?php echo admin_url( 'themes.php' ); ?>"><?php _e( 'Customize Your Site' ); ?></a>
    15761575        <?php if ( current_user_can( 'install_themes' ) || ( current_user_can( 'switch_themes' ) && count( wp_get_themes( array( 'allowed' => true ) ) ) > 1 ) ) : ?>
    1577             <p class="hide-if-no-customize"><?php printf( __( 'or, <a href="%s">change your theme completely</a>' ), $customize_themes_link ); ?></p>
     1576            <?php $themes_link = current_user_can( 'customize' ) ? add_query_arg( 'autofocus[panel]', 'themes', admin_url( 'customize.php' ) ) : admin_url( 'themes.php' ); ?>
     1577            <p class="hide-if-no-customize"><?php printf( __( 'or, <a href="%s">change your theme completely</a>' ), $themes_link ); ?></p>
    15781578        <?php endif; ?>
    15791579    </div>
Note: See TracChangeset for help on using the changeset viewer.