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

props UaMV, DrewAPicture.
fixes #29025.

git-svn-id: https://develop.svn.wordpress.org/trunk@31075 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2015-01-08 00:25:26 +00:00
parent ca34257bd6
commit 621292d70f

View File

@ -715,15 +715,12 @@ function wp_dashboard_recent_posts( $args ) {
$relative = date_i18n( __( 'M jS' ), $time );
}
if ( current_user_can( 'edit_post', get_the_ID() ) ) {
/* translators: 1: relative date, 2: time, 3: post edit link, 4: post title */
$format = __( '<span>%1$s, %2$s</span> <a href="%3$s">%4$s</a>' );
printf( "<li>$format</li>", $relative, get_the_time(), get_edit_post_link(), _draft_or_post_title() );
} else {
/* translators: 1: relative date, 2: time, 3: post title */
$format = __( '<span>%1$s, %2$s</span> %3$s' );
printf( "<li>$format</li>", $relative, get_the_time(), _draft_or_post_title() );
}
// Use the post edit link for those who can edit, the permalink otherwise.
$recent_post_link = current_user_can( 'edit_post', get_the_ID() ) ? get_edit_post_link() : get_permalink();
/* translators: 1: relative date, 2: time, 3: post edit link or permalink, 4: post title */
$format = __( '<span>%1$s, %2$s</span> <a href="%3$s">%4$s</a>' );
printf( "<li>$format</li>", $relative, get_the_time(), $recent_post_link, _draft_or_post_title() );
}
echo '</ul>';