Skip to content

Commit

Permalink
Fix post date scheduling between statuses
Browse files Browse the repository at this point in the history
Cleanup and add comments for time/schedule fix.

Update timestamp on edit, make sure timestamp is correct between statuses.

Time shouldn't update when scheduling.
  • Loading branch information
Connor Jennings on Mac authored and cojennin committed Oct 28, 2013
1 parent ac462ad commit 00bc533
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions modules/custom-status/custom-status.php
Expand Up @@ -1326,14 +1326,18 @@ function fix_custom_status_timestamp( $data ) {
// We're only going to normalize the post_date_gmt if the user hasn't set a custom date in the metabox
// and the current post_date_gmt isn't already future or past-ized
foreach ( array('aa', 'mm', 'jj', 'hh', 'mn') as $timeunit ) {
if ( !empty( $_POST['hidden_' . $timeunit] ) && (($_POST['hidden_' . $timeunit] != $_POST[$timeunit] ) || ( $_POST['hidden_' . $timeunit] != $_POST['cur_' . $timeunit] )) ) {
//Hidden time will equal the current time if we've created a new post, or the time we've selected if we've scheduled the post
//The only thing that we need to care about is whether or not someone has modified the date/time.
if( ( !empty( $_POST['cur_' . $timeunit] ) && $_POST['cur_' . $timeunit] != $_POST[$timeunit] ) ) {
$ef_normalize_post_date_gmt = false;
break;
}
}

if ( $ef_normalize_post_date_gmt )
if ( in_array( $data['post_status'], $status_slugs ) )
if ( in_array( $data['post_status'], $status_slugs ) )
$data['post_date_gmt'] = '0000-00-00 00:00:00';

return $data;
}

Expand Down

0 comments on commit 00bc533

Please sign in to comment.