Make WordPress Core


Ignore:
Timestamp:
08/19/2009 08:35:24 AM (16 years ago)
Author:
azaozz
Message:

"Trash" updates, props caesarsgrunt, see #4529

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/capabilities.php

    r11019 r11841  
    828828        if ( $user_id == $post_author_data->ID ) {
    829829            // If the post is published...
    830             if ( 'publish' == $post->post_status )
     830            if ( 'publish' == $post->post_status ) {
    831831                $caps[] = 'edit_published_posts';
    832             else
     832            } elseif ( 'trash' == $post->post_status ) {
     833                $trash_meta = get_option('wp_trash_meta');
     834                if ( is_array($trash_meta) && isset($trash_meta['posts'][$post->ID]['status']) && $trash_meta['posts'][$post->ID]['status'] == 'publish' )
     835                    $caps[] = 'edit_published_posts';
     836            } else {
    833837                // If the post is draft...
    834838                $caps[] = 'edit_posts';
     839            }
    835840        } else {
    836841            // The user is trying to edit someone else's post.
     
    852857        if ( $user_id == $page_author_data->ID ) {
    853858            // If the page is published...
    854             if ( 'publish' == $page->post_status )
     859            if ( 'publish' == $page->post_status ) {
    855860                $caps[] = 'edit_published_pages';
    856             else
     861            } elseif ( 'trash' == $page->post_status ) {
     862                $trash_meta = get_option('wp_trash_meta');
     863                if ( is_array($trash_meta) && isset($trash_meta['posts'][$page->ID]['status']) && $trash_meta['posts'][$page->ID]['status'] == 'publish' )
     864                    $caps[] = 'edit_published_pages';
     865            } else {
    857866                // If the page is draft...
    858867                $caps[] = 'edit_pages';
     868            }
    859869        } else {
    860870            // The user is trying to edit someone else's page.
Note: See TracChangeset for help on using the changeset viewer.