From bc8f242382e283e46fb6fe89b39d025d9bc8ff39 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Wed, 22 Feb 2006 19:17:28 +0000 Subject: [PATCH] Fix edit links. git-svn-id: https://develop.svn.wordpress.org/trunk@3567 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/template-functions-links.php | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/wp-includes/template-functions-links.php b/wp-includes/template-functions-links.php index e22d4b777e..d5dfc52304 100644 --- a/wp-includes/template-functions-links.php +++ b/wp-includes/template-functions-links.php @@ -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 . "$link" . $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&comment=$comment->comment_ID"; + $location = get_settings('siteurl') . "/wp-admin/comment.php?action=editcomment&comment=$comment->comment_ID"; echo $before . "$link" . $after; }