Created
July 21, 2021 18:47
-
-
Save ideadude/c5ed6f35e0f7d570296cdfbceb8f9497 to your computer and use it in GitHub Desktop.
Convert Ultimate Member address fields to use PMPro user meta keys.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add this code into a Code Snippet and set the option to | |
* "run only once". Then click the play button from the Snippets | |
* page to run this script. | |
* These meta keys: address, city_name, state_name, country_name, postal_code, and phone_no | |
* will become: pmpro_baddress1, pmpro_bcity, pmpro_bstate, pmpro_bcountry, pmpro_bzipcode, and pmpro_bphone | |
*/ | |
global $wpdb; | |
$sqlQuery = "UPDATE $wpdb->usermeta SET meta_key = 'pmpro_baddress1' WHERE meta_key = 'address'"; | |
$wpdb->query( $sqlQuery ); | |
$sqlQuery = "UPDATE $wpdb->usermeta SET meta_key = 'pmpro_bcity' WHERE meta_key = 'city_name'"; | |
$wpdb->query( $sqlQuery ); | |
$sqlQuery = "UPDATE $wpdb->usermeta SET meta_key = 'pmpro_bstate' WHERE meta_key = 'state_name'"; | |
$wpdb->query( $sqlQuery ); | |
$sqlQuery = "UPDATE $wpdb->usermeta SET meta_key = 'pmpro_bcountry' WHERE meta_key = 'country_name'"; | |
$wpdb->query( $sqlQuery ); | |
$sqlQuery = "UPDATE $wpdb->usermeta SET meta_key = 'pmpro_bzipcode' WHERE meta_key = 'postal_code'"; | |
$wpdb->query( $sqlQuery ); | |
$sqlQuery = "UPDATE $wpdb->usermeta SET meta_key = 'pmpro_bphone' WHERE meta_key = 'phone_no'"; | |
$wpdb->query( $sqlQuery ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment