Skip to content

Function

Update TML.

tml_admin_update( )

Source

function tml_admin_update() {
    $version = tml_get_installed_version();

    // Bail if no update needed
    if ( version_compare( $version, THEME_MY_LOGIN_VERSION, '>=' ) ) {
        return;
    }

    // 7.0 upgrade
    if ( version_compare( $version, '7.0', '<' ) ) {
        // Initial migration
        $options = get_option( 'theme_my_login', array() );
        if ( ! empty( $options ) ) {
            if ( ! empty( $options['login_type'] ) ) {
                update_site_option( 'tml_login_type', $options['login_type'] );
            }
            delete_option( 'theme_my_login' );
        }
    }

    // Set the first time install date
    if ( ! get_site_option( '_tml_installed_at' ) ) {
        update_site_option( '_tml_installed_at', time() );
    }

    // Set the update date
    update_site_option( '_tml_updated_at', time() );

    // Store the previous version
    if ( ! empty( $version ) ) {
        update_site_option( '_tml_previous_version', $version );
    }

    // Bump the installed version
    update_site_option( '_tml_version', THEME_MY_LOGIN_VERSION );

    // Force permalinks to be regenerated
    tml_flush_rewrite_rules();
}

Uses

Changelog

VersionDescription
7.0 Introduced.