More Taxonomy cap checks. See #12035

git-svn-id: http://svn.automattic.com/wordpress/trunk@13212 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
dd32 2010-02-19 09:33:50 +00:00
parent 7d258d93af
commit ce0590be8c
1 changed files with 8 additions and 6 deletions

View File

@ -619,11 +619,12 @@ function get_tag_feed_link($tag_id, $feed = '') {
* @return string
*/
function get_edit_tag_link( $tag_id = 0, $taxonomy = 'post_tag' ) {
$tag = get_term($tag_id, $taxonomy);
if ( !current_user_can('manage_categories') )
$tax = get_taxonomy($taxonomy);
if ( !current_user_can($tax->edit_cap) )
return;
$tag = get_term($tag_id, $taxonomy);
$location = admin_url('edit-tags.php?action=edit&taxonomy=' . $taxonomy . '&tag_ID=' . $tag->term_id);
return apply_filters( 'get_edit_tag_link', $location );
}
@ -640,11 +641,12 @@ function get_edit_tag_link( $tag_id = 0, $taxonomy = 'post_tag' ) {
* @return string|null HTML content, if $echo is set to false.
*/
function edit_tag_link( $link = '', $before = '', $after = '', $tag = null ) {
$tag = get_term($tag, 'post_tag');
if ( !current_user_can('manage_categories') )
$tax = get_taxonomy('post_tag');
if ( !current_user_can($tax->edit_cap) )
return;
$tag = get_term($tag, 'post_tag');
if ( empty($link) )
$link = __('Edit This');