Adding Default Settings to Theme My Login plugin

  1. The data wasn’t fully unserialized and properly made as a multidimensional array
  2. wp_parse_args() used unnecessarily.
  3. get_option() used unnecessarily.

    function nls_tml_default_settings() {
    $nlstml = array(
            'enable_css'     => 1,
            'login_type'     => 'default',
            'active_modules' => array(
                'custom-passwords/custom-passwords.php',
                'custom-user-links/custom-user-links.php',
                'recaptcha/recaptcha.php',
                'security/security.php',
                'themed-profiles/themed-profiles.php',
                'user-moderation/user-moderation.php',
            ),
            'version'        => '6.4.10',
        );
        update_option( 'theme_my_login', $nlstml );
    
    $nlsrecap = array(
        'public_key'  => 'sitekey',
        'private_key' => 'secretkey',
        'theme'       => 'light',
    );
    update_option( 'theme_my_login_recaptcha', $nlsrecap );
    
    $nlssecurity = array(
        'private_site'  => '',
        'private_login' => 1,
        'failed_login'  => array(
            'threshold'               => 5,
            'threshold_duration'      => 1,
            'threshold_duration_unit' => 'hour',
            'lockout_duration'        => 24,
            'lockout_duration_unit'   => 'hour',
        ),
    );
    update_option( 'theme_my_login_security', $nlssecurity );
    
    $nlsprofiles = array(
        'administrator' => array(
            'theme_profile'  => 1,
            'restrict_admin' => '',
        ),
        'editor'        => array(
            'theme_profile'  => 1,
            'restrict_admin' => 1,
        ),
        'author'        => array(
            'theme_profile'  => 1,
            'restrict_admin' => 1,
        ),
        'contributor'   => array(
            'theme_profile'  => 1,
            'restrict_admin' => 1,
        ),
        'subscriber'    => array(
            'theme_profile'  => 1,
            'restrict_admin' => 1,
        ),
        'wpseo_manager' => array(
            'theme_profile'  => 1,
            'restrict_admin' => 1,
        ),
        'wpseo_editor'  => array(
            'theme_profile'  => 1,
            'restrict_admin' => 1,
        ),
    );
    update_option( 'theme_my_login_themed_profiles', $nlsprofiles );
    
    $nlsmoderation = array(
        'type' => 'admin',
    );
        update_option( 'theme_my_login_moderation', $nlsmoderation );
    
    }
    

    register_activation_hook( WP_PLUGIN_DIR . ‘/theme-my-login/theme-my-login.php’, ‘nls_tml_default_settings’ );