From 83728df100308f9286fd0e356d23e7676dba57f5 Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 22 Feb 2006 19:17:28 +0000 Subject: [PATCH] Fix edit links. git-svn-id: http://svn.automattic.com/wordpress/trunk@3567 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- 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 e22d4b777..d5dfc5230 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; }