Title: Fixing data via CSV
Last modified: May 26, 2021

---

# Fixing data via CSV

 *  Resolved [spannerz](https://wordpress.org/support/users/spannerz/)
 * (@spannerz)
 * [5 years ago](https://wordpress.org/support/topic/fixing-data-via-csv/)
 * Hello folks,
 * I’m having issues regarding dates during the Import process.
    Well, I’m trying
   to fix dates I broke the first time round, since a lot of them were reversed 
   since my CSV had dates in UK format of dd/mm/yyyy and the months were reversed
   and it expired a load of my members.
 * I have built a CSV containing the correct mebership_startdate and membership_enddate
   values but there are issues with the way the Import from CSV and PMPro Import
   from CSV handle NULL values for my Memberships that have no expiry date.
 * Currently, if I have anything other than a date in the future set, the Membership
   is expired with todays date as the enddate.
    I have tried NULL, “NULL”, “Never”,
   0000-00-00 and leaving the cell blank. I have a CSV tool called CSVED which is
   very useful for all sorts of CSV operations, and I’ve tried that since I read
   that Excel doesn’t actually treat a blank cell as NULL.
 * I am currently looking at the pmpro-import-users-from-csv.php file with this 
   section of code:
 *     ```
       		//if membership was in the past make it inactive
       		if($membership_status === "inactive" || (!empty($membership_enddate) && $membership_enddate !== NULL && strtotime($membership_enddate, current_time('timestamp')) < current_time('timestamp')))
       		{			
       			$sqlQuery = "UPDATE $wpdb->pmpro_memberships_users SET status = 'inactive' WHERE user_id = '" . $user_id . "' AND membership_id = '" . $membership_id . "'";		
       			$wpdb->query($sqlQuery);
       			$membership_in_the_past = true;
       		}
   
       		if($membership_status === "active" && (empty($membership_enddate) || $membership_enddate === NULL || $membership_enddate === "Never" || $membership_enddate === "0000-00-00" || strtotime($membership_enddate, current_time('timestamp')) >= current_time('timestamp')))
       		{			
       			$sqlQuery = $wpdb->prepare("UPDATE {$wpdb->pmpro_memberships_users} SET status = 'active' WHERE user_id = %d AND membership_id = %d", $user_id, $membership_id);		
       			$wpdb->query($sqlQuery);
   
       		}
       	}
       ```
   
 * I have a CDV with these headings :
    _membno_ id user_login first_name last_name
   user_email membership_id membership_initial_payment membership_billing_amount
   membership_cycle_number membership_cycle_period membership_status membership_startdate
   membership_enddate _AnniversaryDate AnniversaryMonth PackIssued CardIssued card
   membership\_year Comments_ The headings in Italic are my custom fields and they
   work fine.
 * I need the import to register a Membership as non-expiring, without it setting
   the endddate to 1970-01-01 or 0000-00-00 and setting the status to “inactive”&
   the orders to “cancelled”
 * If I can just get the import to read a NULL text value as NULL for mySQL that
   would cure it 🙂
 * Any ideas, folks?
 * Regards,
    Simon

Viewing 1 replies (of 1 total)

 *  Plugin Author [Andrew Lima](https://wordpress.org/support/users/andrewza/)
 * (@andrewza)
 * [5 years ago](https://wordpress.org/support/topic/fixing-data-via-csv/#post-14489208)
 * Hi Simon,
 * Thank you for using Paid Memberships Pro.
 * Unfortunately we are not allowed to support non-WordPress.org plugins on this
   forum as it goes against the WordPress guidelines – [https://wordpress.org/support/guidelines/](https://wordpress.org/support/guidelines/)
 * Please can you open a support ticket on [http://www.paidmembershipspro.com](http://www.paidmembershipspro.com)
   and someone from our team can assist you with this Plus Add On.
 * Thank you for understanding.

Viewing 1 replies (of 1 total)

The topic ‘Fixing data via CSV’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/paid-memberships-pro_f1dacb.svg)
 * [Paid Memberships Pro - Content Restriction, User Registration, & Paid Subscriptions](https://wordpress.org/plugins/paid-memberships-pro/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/paid-memberships-pro/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/paid-memberships-pro/)
 * [Active Topics](https://wordpress.org/support/plugin/paid-memberships-pro/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/paid-memberships-pro/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/paid-memberships-pro/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Andrew Lima](https://wordpress.org/support/users/andrewza/)
 * Last activity: [5 years ago](https://wordpress.org/support/topic/fixing-data-via-csv/#post-14489208)
 * Status: resolved