WordPress.org

Make WordPress Core

Ticket #17499: 17499.other-pages.2.diff

File 17499.other-pages.2.diff, 2.2 KB (added by sbressler, 4 years ago)

Patch for edit user, edit link, and edit media pages (with proper cap checks). No link when editing profile page

  • wp-admin/edit-link-form.php

     
    5353?> 
    5454<div class="wrap"> 
    5555<?php screen_icon(); ?> 
    56 <h2><?php echo esc_html( $title ); ?></h2> 
     56<h2><?php echo esc_html( $title ); ?>  <a href="link-add.php" class="add-new-h2"><?php echo esc_html_x('Add New', 'link'); ?></a></h2> 
    5757 
    5858<?php if ( isset( $_GET['added'] ) ) : ?> 
    5959<div id="message" class="updated"><p><?php _e('Link added.'); ?></p></div> 
  • wp-admin/media.php

     
    9797 
    9898<div class="wrap"> 
    9999<?php screen_icon(); ?> 
    100 <h2><?php _e( 'Edit Media' ); ?></h2> 
     100<h2> 
     101<?php 
     102echo esc_html( $title ); 
     103if ( current_user_can( 'upload_files' ) ) { ?> 
     104        <a href="media-new.php" class="add-new-h2"><?php echo esc_html_x('Add New', 'file'); ?></a> 
     105<?php } ?> 
     106</h2> 
    101107 
    102108<form method="post" action="" class="media-upload-form" id="media-single-form"> 
    103109<p class="submit" style="padding-bottom: 0;"> 
  • wp-admin/user-edit.php

     
    168168 
    169169<div class="wrap" id="profile-page"> 
    170170<?php screen_icon(); ?> 
    171 <h2><?php echo esc_html( $title ); ?></h2> 
     171<h2> 
     172<?php 
     173echo esc_html( $title ); 
     174if ( !IS_PROFILE_PAGE ) { // Add links to add/promote users as long as this is not the current user's profile page 
     175        if ( current_user_can( 'create_users' ) ) { ?> 
     176                <a href="user-new.php" class="add-new-h2"><?php echo esc_html_x( 'Add New', 'user' ); ?></a> 
     177        <?php } elseif ( is_multisite() && current_user_can( 'promote_users' ) ) { ?> 
     178                <a href="user-new.php" class="add-new-h2"><?php echo esc_html_x( 'Add Existing', 'user' ); ?></a> 
     179        <?php } 
     180} ?> 
     181</h2> 
    172182 
    173183<form id="your-profile" action="<?php echo esc_url( self_admin_url( IS_PROFILE_PAGE ? 'profile.php' : 'user-edit.php' ) ); ?>" method="post"<?php do_action('user_edit_form_tag'); ?>> 
    174184<?php wp_nonce_field('update-user_' . $user_id) ?>