Skip to content

Commit

Permalink
Fix issue where invalid mm_install_date was preventing `bh_plugin_i…
Browse files Browse the repository at this point in the history
…nstall_date` from being set properly. (#30)
  • Loading branch information
wpscholar authored Aug 26, 2020
1 parent ad1d616 commit 845114a
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions inc/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,11 @@ function bh_setup() {
update_option( 'mm_cron', $events );
}
if ( ! bh_has_plugin_install_date() ) {
$date = false;
if ( ! empty( $install_date ) ) {
try {
$date = DateTime::createFromFormat( 'M d, Y', $install_date );
bh_set_plugin_install_date( $date->format( 'U' ) );
} catch ( Exception $e ) {
bh_set_plugin_install_date( gmdate( 'U' ) );
}
} else {
bh_set_plugin_install_date( gmdate( 'U' ) );
$date = DateTime::createFromFormat( 'M d, Y', $install_date );
}
bh_set_plugin_install_date( $date ? $date->format( 'U' ) : gmdate( 'U' ) );
}
}

Expand Down

0 comments on commit 845114a

Please sign in to comment.