function pmpro_upgrade_1_7() { pmpro_db_delta(); //just a db delta pmpro_setOption("db_version", "1.7"); return 1.7; }
function pmpro_upgrade_1() { /* default options */ $nonmembertext = sprintf(__('This content is for !!levels!! members only.<br /><a href="%s">Register</a>', 'pmpro'), wp_login_url() . "?action=register"); pmpro_setOption("nonmembertext", $nonmembertext); $notloggedintext = sprintf(__('This content is for !!levels!! members only.<br /><a href="%s">Log In</a> <a href="%s">Register</a>', 'pmpro'), wp_login_url(), wp_login_url() . "?action=register"); '?action=register">Register</a>'; pmpro_setOption("notloggedintext", $notloggedintext); $rsstext = __("This content is for !!levels!! members only. Visit the site and log in/register to read.", 'pmpro'); pmpro_setOption("rsstext", $rsstext); $gateway_environment = "sandbox"; pmpro_setOption("gateway_environment", $gateway_environment); $pmpro_currency = "USD"; pmpro_setOption("currency", $pmpro_currency); $pmpro_accepted_credit_cards = "Visa,Mastercard,American Express,Discover"; pmpro_setOption("accepted_credit_cards", $pmpro_accepted_credit_cards); $parsed = parse_url(home_url()); $hostname = $parsed['host']; $hostparts = explode(".", $hostname); $email_domain = $hostparts[count($hostparts) - 2] . "." . $hostparts[count($hostparts) - 1]; $from_email = "wordpress@" . $email_domain; pmpro_setOption("from_email", $from_email); $from_name = "WordPress"; pmpro_setOption("from_name", $from_name); //setting new email settings defaults pmpro_setOption("email_admin_checkout", "1"); pmpro_setOption("email_admin_changes", "1"); pmpro_setOption("email_admin_cancels", "1"); pmpro_setOption("email_admin_billing", "1"); pmpro_setOption("tospage", ""); //db update pmpro_db_delta(); //update version and return pmpro_setOption("db_version", "1.71"); //no need to run other updates return 1.71; }
function pmpro_checkForUpgrades() { $pmpro_db_version = pmpro_getOption("db_version"); //if we can't find the DB tables, reset db_version to 0 global $wpdb; $wpdb->hide_errors(); $wpdb->pmpro_membership_levels = $wpdb->prefix . 'pmpro_membership_levels'; $table_exists = $wpdb->query("SHOW TABLES LIKE '" . $wpdb->pmpro_membership_levels . "'"); if (!$table_exists) { $pmpro_db_version = 0; } //default options if (!$pmpro_db_version) { require_once PMPRO_DIR . "/includes/updates/upgrade_1.php"; $pmpro_db_version = pmpro_upgrade_1(); } //upgrading from early early versions of PMPro if ($pmpro_db_version < 1.115) { require_once PMPRO_DIR . "/includes/updates/upgrade_1_1_15.php"; $pmpro_db_version = pmpro_upgrade_1_1_15(); } //upgrading from early early versions of PMPro if ($pmpro_db_version < 1.23) { require_once PMPRO_DIR . "/includes/updates/upgrade_1_2_3.php"; $pmpro_db_version = pmpro_upgrade_1_2_3(); } //upgrading from early early versions of PMPro if ($pmpro_db_version < 1.318) { require_once PMPRO_DIR . "/includes/updates/upgrade_1_3_18.php"; $pmpro_db_version = pmpro_upgrade_1_3_18(); } //upgrading from early early versions of PMPro if ($pmpro_db_version < 1.4) { require_once PMPRO_DIR . "/includes/updates/upgrade_1_4.php"; $pmpro_db_version = pmpro_upgrade_1_4(); } //upgrading from early early versions of PMPro if ($pmpro_db_version < 1.42) { require_once PMPRO_DIR . "/includes/updates/upgrade_1_4_2.php"; $pmpro_db_version = pmpro_upgrade_1_4_2(); } //upgrading from early early versions of PMPro if ($pmpro_db_version < 1.48) { require_once PMPRO_DIR . "/includes/updates/upgrade_1_4_8.php"; $pmpro_db_version = pmpro_upgrade_1_4_8(); } //upgrading from early early versions of PMPro if ($pmpro_db_version < 1.5) { require_once PMPRO_DIR . "/includes/updates/upgrade_1_5.php"; $pmpro_db_version = pmpro_upgrade_1_5(); } //upgrading from early early versions of PMPro if ($pmpro_db_version < 1.59) { require_once PMPRO_DIR . "/includes/updates/upgrade_1_5_9.php"; $pmpro_db_version = pmpro_upgrade_1_5_9(); } //upgrading from early early versions of PMPro if ($pmpro_db_version < 1.6) { require_once PMPRO_DIR . "/includes/updates/upgrade_1_6.php"; $pmpro_db_version = pmpro_upgrade_1_6(); } //fix for fresh 1.7 installs if ($pmpro_db_version == 1.7) { //check if we have an id column in the memberships_users table $wpdb->pmpro_memberships_users = $wpdb->prefix . 'pmpro_memberships_users'; $col = $wpdb->get_var("SELECT id FROM {$wpdb->pmpro_memberships_users} LIMIT 1"); if ($wpdb->last_error == "Unknown column 'id' in 'field list'") { //redo 1.5 fix require_once PMPRO_DIR . "/includes/updates/upgrade_1_5.php"; pmpro_upgrade_1_5(); } pmpro_db_delta(); pmpro_setOption("db_version", "1.703"); $pmpro_db_version = 1.703; } //updates from this point on should be like this if DB only if ($pmpro_db_version < 1.71) { pmpro_db_delta(); pmpro_setOption("db_version", "1.71"); $pmpro_db_version = 1.71; } //schedule the credit card expiring cron if ($pmpro_db_version < 1.72) { //schedule the credit card expiring cron pmpro_maybe_schedule_event(current_time('timestamp'), 'monthly', 'pmpro_cron_credit_card_expiring_warnings'); pmpro_setOption("db_version", "1.72"); $pmpro_db_version = 1.72; } //register capabilities required for menus now if ($pmpro_db_version < 1.79) { //need to register caps for menu pmpro_activation(); pmpro_setOption("db_version", "1.79"); $pmpro_db_version = 1.79; } //set default filter_queries setting if ($pmpro_db_version < 1.791) { if (!pmpro_getOption("showexcerpts")) { pmpro_setOption("filterqueries", 1); } else { pmpro_SetOption("filterqueries", 0); } pmpro_setOption("db_version", "1.791"); $pmpro_db_version = 1.791; } //fix subscription ids on stripe orders require_once PMPRO_DIR . "/includes/updates/upgrade_1_8_6_9.php"; //need to include this for AJAX calls if ($pmpro_db_version < 1.869) { $pmpro_db_version = pmpro_upgrade_1_8_6_9(); } //Remove extra cron jobs inserted in version 1.8.7 and 1.8.7.1 if ($pmpro_db_version < 1.87) { require_once PMPRO_DIR . "/includes/updates/upgrade_1_8_7.php"; $pmpro_db_version = pmpro_upgrade_1_8_7(); } /* v1.8.8 * Running the cron job cleanup again. * Fixing old $0 Stripe orders. * Fixing old Authorize.net orders with empty status. */ require_once PMPRO_DIR . "/includes/updates/upgrade_1_8_8.php"; if ($pmpro_db_version < 1.88) { $pmpro_db_version = pmpro_upgrade_1_8_8(); } /* v1.8.9.1 * Fixing Stripe orders where user_id/membership_id = 0 */ require_once PMPRO_DIR . "/includes/updates/upgrade_1_8_9_1.php"; if ($pmpro_db_version < 1.891) { $pmpro_db_version = pmpro_upgrade_1_8_9_1(); } /* v1.8.9.2 (db v1.9) * Changed 'code' column of pmpro_membership_orders table to 32 characters. */ if ($pmpro_db_version < 1.892) { pmpro_db_delta(); $pmpro_db_version = 1.892; pmpro_setOption("db_version", "1.892"); } /* v1.8.9.3 (db v1.91) * Fixing incorrect start and end dates. */ require_once PMPRO_DIR . "/includes/updates/upgrade_1_8_9_3.php"; if ($pmpro_db_version < 1.91) { $pmpro_db_version = pmpro_upgrade_1_8_9_3(); } /* v1.8.10 (db v1.92) Added checkout_id column to pmpro_membership_orders */ if ($pmpro_db_version < 1.92) { pmpro_db_delta(); $pmpro_db_version = 1.92; pmpro_setOption("db_version", "1.92"); } /* v1.8.10.2 (db v1.93) Run dbDelta again to fix broken/missing orders tables. */ if ($pmpro_db_version < 1.93) { pmpro_db_delta(); $pmpro_db_version = 1.93; pmpro_setOption("db_version", "1.93"); } }