Skip to content

Instantly share code, notes, and snippets.

@strangerstudios
Last active August 29, 2015 14:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save strangerstudios/4604f62e9812cf3afde7 to your computer and use it in GitHub Desktop.
Save strangerstudios/4604f62e9812cf3afde7 to your computer and use it in GitHub Desktop.
Update the startdate column for PMPro members to match their user_registered date if their startdate is empty.
# If users were imported without a membership_startdate set or
# otherwise don't have a startdate value in the wp_pmpro_memberships_users
# table, this query will set their startdate to the date they registered.
# NOTE: You should change the table names to match your own prefixes.
UPDATE wp_pmpro_memberships_users mu
LEFT JOIN wp_users u ON mu.user_id = u.ID
SET mu.startdate = u.user_registered
WHERE mu.startdate IS NULL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment