[wp-trac] [WordPress Trac] #9702: edit_post_link() ; edit_category_link() ; edit_tags_link()

WordPress Trac wp-trac at lists.automattic.com
Sat May 2 14:08:00 GMT 2009


#9702: edit_post_link() ; edit_category_link() ; edit_tags_link()
-------------------------+--------------------------------------------------
 Reporter:  ramiy        |       Owner:                                   
     Type:  enhancement  |      Status:  new                              
 Priority:  low          |   Milestone:  2.9                              
Component:  Themes       |     Version:  2.7.1                            
 Severity:  minor        |    Keywords:  edit,link,admin,theme,enhancement
-------------------------+--------------------------------------------------
 Just like '''edit_post_link()''', i suggest to add
 '''edit_category_link()''' and '''edit_tags_link()'''. Those function will
 be used in themes. They will make an aesy access to admin tag/category
 edit panel. And link edit_post_link(), only users that have the right
 authorization will see the links.

 ----

 // Link to edit Categories like the link to edit posts

 function edit_category_link($id, $link = 'Edit This', $before = '', $after
 = '') {
         global $post;
         if ( is_category() ) {
                 if ( ! current_user_can('manage_categories', $id) )
                         return;
                 $location = get_settings('siteurl') . "/wp-
 admin/categories.php?action=edit&cat_ID=$id";
         }
         echo $before . "<a href=\"$location\">$link</a>" . $after;
 }



 // Link to edit Tags like the link to edit posts

 function edit_tags_link($id, $link = 'Edit This', $before = '', $after =
 '') {
         global $post;
         if ( is_tag() ) {
                 if ( ! current_user_can('manage_categories', $id) )
                         return;
                 $location = get_settings('siteurl') . "/wp-admin/edit-
 tags.php?action=edit&tag_ID=$id";
         }
         echo $before . "<a href=\"$location\">$link</a>" . $after;
 }

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/9702>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list