Fix edit links.

git-svn-id: http://svn.automattic.com/wordpress/trunk@3567 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2006-02-22 19:17:28 +00:00
parent 5322fc2faa
commit 83728df100

View File

@ -208,13 +208,18 @@ function get_feed_link($feed='rss2') {
function edit_post_link($link = 'Edit This', $before = '', $after = '') {
global $post;
if ( ! current_user_can('edit_post', $post->ID) )
return;
if ( is_attachment() )
return;
else
if( $post->post_type == 'page' ) {
if ( ! current_user_can('edit_page', $post->ID) )
return;
$file = 'page';
} else {
if ( ! current_user_can('edit_post', $post->ID) )
return;
$file = 'post';
}
$location = get_settings('siteurl') . "/wp-admin/{$file}.php?action=edit&post=$post->ID";
echo $before . "<a href=\"$location\">$link</a>" . $after;
@ -223,10 +228,14 @@ function edit_post_link($link = 'Edit This', $before = '', $after = '') {
function edit_comment_link($link = 'Edit This', $before = '', $after = '') {
global $post, $comment;
if ( ! current_user_can('edit_post', $post->ID) )
return;
if( $post->post_type == 'page' )
if ( ! current_user_can('edit_page', $post->ID) )
return;
else
if ( ! current_user_can('edit_post', $post->ID) )
return;
$location = get_settings('siteurl') . "/wp-admin/post.php?action=editcomment&amp;comment=$comment->comment_ID";
$location = get_settings('siteurl') . "/wp-admin/comment.php?action=editcomment&amp;comment=$comment->comment_ID";
echo $before . "<a href='$location'>$link</a>" . $after;
}