Make WordPress Core

Changeset 31075


Ignore:
Timestamp:
01/08/2015 12:25:26 AM (10 years ago)
Author:
SergeyBiryukov
Message:

In dashboard activity widget, display a front-end link if the user cannot edit the post.

props UaMV, DrewAPicture.
fixes #29025.

File:
1 edited

Legend:

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

    r30203 r31075  
    716716            }
    717717
    718             if ( current_user_can( 'edit_post', get_the_ID() ) ) {
    719                 /* translators: 1: relative date, 2: time, 3: post edit link, 4: post title */
    720                 $format = __( '<span>%1$s, %2$s</span> <a href="%3$s">%4$s</a>' );
    721                 printf( "<li>$format</li>", $relative, get_the_time(), get_edit_post_link(), _draft_or_post_title() );
    722             } else {
    723                 /* translators: 1: relative date, 2: time, 3: post title */
    724                 $format = __( '<span>%1$s, %2$s</span> %3$s' );
    725                 printf( "<li>$format</li>", $relative, get_the_time(), _draft_or_post_title() );
    726             }
     718            // Use the post edit link for those who can edit, the permalink otherwise.
     719            $recent_post_link = current_user_can( 'edit_post', get_the_ID() ) ? get_edit_post_link() : get_permalink();
     720
     721            /* translators: 1: relative date, 2: time, 3: post edit link or permalink, 4: post title */
     722            $format = __( '<span>%1$s, %2$s</span> <a href="%3$s">%4$s</a>' );
     723            printf( "<li>$format</li>", $relative, get_the_time(), $recent_post_link, _draft_or_post_title() );
    727724        }
    728725
Note: See TracChangeset for help on using the changeset viewer.