Plugin Directory

Changeset 1242929


Ignore:
Timestamp:
09/11/2015 01:25:55 AM (11 years ago)
Author:
RylanH
Message:

Fix for users who turn off revisions

Location:
storyform/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • storyform/trunk/class-storyform-admin-meta-box.php

    r1237746 r1242929  
    8989        if( $post['post_status'] === 'publish' ){
    9090            $array = array_values( wp_get_post_revisions( $post_id ) );
    91             $revision = $array[0]->to_array();
    92             if( strtotime( $revision['post_date'] ) > strtotime( $post['post_modified'] ) ){
    93                 $unpublished_changes = true;
     91            if( count( $array ) ){
     92                $revision = $array[0]->to_array();
     93                if( strtotime( $revision['post_date'] ) > strtotime( $post['post_modified'] ) ){
     94                    $unpublished_changes = true;
     95                }
    9496            }
    9597            $status = 'published';
  • storyform/trunk/class-storyform-editor-page.php

    r1239252 r1242929  
    135135        if( $post['post_status'] === 'publish' ){
    136136            $array = array_values( wp_get_post_revisions( $id ) );
    137             $revision = $array[0]->to_array();
    138             $post['post_content'] = $revision['post_content'];
    139             $post['post_title'] = $revision['post_title'];
    140             $post['post_excerpt'] = $revision['post_excerpt'];
    141             $post['unpublished_changes'] = true;
     137
     138            if( count( $array ) ){
     139                $revision = $array[0]->to_array();
     140                $post['post_content'] = $revision['post_content'];
     141                $post['post_title'] = $revision['post_title'];
     142                $post['post_excerpt'] = $revision['post_excerpt'];
     143                $post['unpublished_changes'] = true;
     144            }
    142145        }
    143146
Note: See TracChangeset for help on using the changeset viewer.