Make WordPress Core


Ignore:
Timestamp:
07/24/2013 06:08:14 AM (12 years ago)
Author:
nacin
Message:

Revisions changes.

  • Eliminates the bloated Revisions meta box in favor of 'Revisions: #' in the publish box.
  • Adds ability to compare autosave to current post, when revisions are disabled.
  • Makes autosaves stand out visually, including "Restore This Autosave".

Also:

  • Adds missing capability check for restoring a revision.
  • When no revision matches the post's current modified time, avoid marking an autosave as 'current'.
  • Fixes wp_get_post_autosave() to return an autosave even when revisions are disabled.
  • Add 'check_enabled' arg to wp_get_post_revisions(); false avoids the wp_revisions_enabled() check.
  • Adds a responsive slider that is narrower for fewer versions. props markjaquith.

see #24804.

File:
1 edited

Legend:

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

    r24520 r24790  
    158158 */
    159159function wp_get_post_autosave( $post_id, $user_id = 0 ) {
    160     $revisions = wp_get_post_revisions($post_id);
     160    $revisions = wp_get_post_revisions( $post_id, array( 'check_enabled' => false ) );
    161161
    162162    foreach ( $revisions as $revision ) {
     
    370370function wp_get_post_revisions( $post_id = 0, $args = null ) {
    371371    $post = get_post( $post_id );
    372     if ( ! $post || empty( $post->ID ) || ! wp_revisions_enabled( $post ) )
     372    if ( ! $post || empty( $post->ID ) )
    373373        return array();
    374374
    375     $defaults = array( 'order' => 'DESC', 'orderby' => 'date' );
     375    $defaults = array( 'order' => 'DESC', 'orderby' => 'date', 'check_enabled' => true );
    376376    $args = wp_parse_args( $args, $defaults );
     377
     378    if ( $args['check_enabled'] && ! wp_revisions_enabled( $post ) )
     379        return array();
     380
    377381    $args = array_merge( $args, array( 'post_parent' => $post->ID, 'post_type' => 'revision', 'post_status' => 'inherit' ) );
    378382
Note: See TracChangeset for help on using the changeset viewer.