Skip to content

Commit

Permalink
Merge pull request #198 from newfold-labs/add/PRESS2-718-onboarding-s…
Browse files Browse the repository at this point in the history
…tart-date

Switch setting mm_install_date to nfd_module_onboarding_start_date
  • Loading branch information
arunshenoy99 authored Mar 22, 2023
2 parents a58de4e + 3a2ff87 commit 0aa5fc3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 24 deletions.
47 changes: 24 additions & 23 deletions includes/Data/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
* Stores all the WordPress Options used in the module.
*/
final class Options {
/**
* Prefix for options in the module.
*
* @var string
*/
/**
* Prefix for options in the module.
*
* @var string
*/

protected static $prefix = 'nfd_module_onboarding_';

/**
* List of all the options.
*
* @var array
*/
/**
* List of all the options.
*
* @var array
*/

protected static $options = array(
'redirect' => 'redirect',
Expand All @@ -28,6 +28,7 @@ final class Options {
'close_comments_days_old' => 'close_comments_days_old',
'comments_per_page' => 'comments_per_page',
'install_date' => 'mm_install_date',
'start_date' => 'start_date',
'allow_major_auto_core_updates' => 'allow_major_auto_core_updates',
'allow_minor_auto_core_updates' => 'allow_minor_auto_core_updates',
'auto_update_plugin' => 'auto_update_plugin',
Expand Down Expand Up @@ -76,21 +77,21 @@ final class Options {
* @return string|boolean
*/
public static function get_option_name( $option_key, $attach_prefix = true ) {
return isset( self::$options[ $option_key ] )
? ( $attach_prefix
? self::$prefix . self::$options[ $option_key ]
: self::$options[ $option_key ]
)
: false;
return isset( self::$options[ $option_key ] )
? ( $attach_prefix
? self::$prefix . self::$options[ $option_key ]
: self::$options[ $option_key ]
)
: false;
}

/**
* Get the list of all options.
*
* @return array
*/
/**
* Get the list of all options.
*
* @return array
*/
public static function get_all_options() {
return self::$options;
return self::$options;
}

/**
Expand All @@ -99,6 +100,6 @@ public static function get_all_options() {
* @return array
*/
public static function get_initialization_options() {
return self::$initialization_options;
return self::$initialization_options;
}
}
2 changes: 1 addition & 1 deletion includes/RestApi/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ public function initialize() {
\update_option( Options::get_option_name( $option_key, false ), $option_value );
}
// Can't be part of initialization constants as they are static.
\update_option( Options::get_option_name( 'install_date', false ), gmdate( 'M d, Y' ) );
\update_option( Options::get_option_name( 'start_date' ), gmdate( 'U' ) );

// Flush permalinks
flush_rewrite_rules();
Expand Down

0 comments on commit 0aa5fc3

Please sign in to comment.