Make WordPress Core

Ticket #21787: 21787.diff

File 21787.diff, 1.5 KB (added by ericlewis, 12 years ago)

Use read_post capability to decide whether to display "View Post" link next to slug editor. Also simplified a 'title' attribute text here, which described slug editing based on post status.

  • wp-admin/includes/post.php

     
    10651065
    10661066        list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    10671067
    1068         if ( 'publish' == $post->post_status ) {
    1069                 $ptype = get_post_type_object($post->post_type);
    1070                 $view_post = $ptype->labels->view_item;
    1071                 $title = __('Click to edit this part of the permalink');
    1072         } else {
    1073                 $title = __('Temporary permalink. Click to edit this part.');
    1074         }
     1068        $post_type_object = get_post_type_object( $post->post_type );   
     1069        if ( current_user_can( $post_type_object->cap->read_post, $post->ID ) )
     1070                $view_post = $post_type_object->labels->view_item;
    10751071
    10761072        if ( false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%') ) {
    10771073                $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . $permalink . "</span>\n";
     
    10991095                }
    11001096        }
    11011097
    1102         $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';
     1098        $post_name_html = '<span id="editable-post-name" title="' . __('Click to edit this part of the permalink') . '">' . $post_name_abridged . '</span>';
    11031099        $display_link = str_replace(array('%pagename%','%postname%'), $post_name_html, $permalink);
    11041100        $view_link = str_replace(array('%pagename%','%postname%'), $post_name, $permalink);
    11051101        $return =  '<strong>' . __('Permalink:') . "</strong>\n";