WordPress.org

Make WordPress Core


Ignore:
Timestamp:
04/18/2008 11:38:21 PM (13 years ago)
Author:
ryan
Message:

Post revisions from mdawaffe. see #6775

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/link-template.php

    r7667 r7747  
    443443}
    444444
    445 function get_edit_post_link( $id = 0 ) {
     445function get_edit_post_link( $id = 0, $context = 'display' ) {
    446446    if ( !$post = &get_post( $id ) )
    447447        return;
     448
     449    if ( 'display' == $context )
     450        $action = 'action=edit&';
     451    else
     452        $action = 'action=edit&';
    448453
    449454    switch ( $post->post_type ) :
     
    460465        $var  = 'attachment_id';
    461466        break;
     467    case 'revision' :
     468        if ( !current_user_can( 'edit_post', $post->ID ) )
     469            return;
     470        $file = 'revision';
     471        $var  = 'revision';
     472        $action = '';
     473        break;
    462474    default :
    463475        if ( !current_user_can( 'edit_post', $post->ID ) )
     
    468480    endswitch;
    469481   
    470     return apply_filters( 'get_edit_post_link', get_bloginfo( 'wpurl' ) . "/wp-admin/$file.php?action=edit&$var=$post->ID", $post->ID );
     482    return apply_filters( 'get_edit_post_link', get_bloginfo( 'wpurl' ) . "/wp-admin/$file.php?{$action}$var=$post->ID", $post->ID );
    471483}
    472484
Note: See TracChangeset for help on using the changeset viewer.