pmpro_upgrade_1_5

The Paid Memberships Pro pmpro upgrade 1 5 function.

Description

pmpro_upgrade_1_5(); 

Usage

  1. if ( !function_exists( 'pmpro_upgrade_1_5' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'paid-memberships-pro/includes/updates/upgrade_1_5.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = pmpro_upgrade_1_5(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/includes/updates/upgrade_1_5.php  
  1. function pmpro_upgrade_1_5() 
  2. /** 
  3. Add the id and status fields to pmpro_memberships_users, change primary key to id instead of user_id 
  4. */ 
  5.  
  6. global $wpdb; 
  7. $wpdb->hide_errors(); 
  8. $wpdb->pmpro_memberships_users = $wpdb->prefix . 'pmpro_memberships_users'; 
  9.  
  10. //remove primary key 
  11. $sqlQuery = "ALTER TABLE `" . $wpdb->pmpro_memberships_users . "` DROP PRIMARY KEY"; 
  12. $wpdb->query($sqlQuery); 
  13.  
  14. //id 
  15. $sqlQuery = "ALTER TABLE `" . $wpdb->pmpro_memberships_users . "` ADD `id` BIGINT( 20 ) UNSIGNED AUTO_INCREMENT FIRST, ADD PRIMARY KEY(id)"; 
  16. $wpdb->query($sqlQuery); 
  17.  
  18. //status 
  19. $sqlQuery = "ALTER TABLE `" . $wpdb->pmpro_memberships_users . "` ADD `status` varchar( 20 ) NOT NULL DEFAULT 'active' AFTER `trial_limit`"; 
  20. $wpdb->query($sqlQuery); 
  21.  
  22. pmpro_setOption("db_version", "1.5"); 
  23. return 1.5;