switch( $option ) {
+ case 'updateEmails';
+ $sql = "
+ SELECT id,organization,email
+ FROM ".$this->wpdb->prefix."connections
+ WHERE email != ''
+ ORDER BY id";
+ $connection_members = $this->wpdb->get_results($sql, ARRAY_A);
+
+ foreach ( $connection_members as $member ) {
+ // Update the email for the member_info record
+ // Need to get the member_info id based on the ref_dest
+ $email_data = unserialize( $member['email'] );
+ $email = '';
+ if ( is_array( $email_data ) ) {
+ reset( $email_data );
+ $eData = current( $email_data );
+ $email = $eData['address'];
+ }
+ if ( $email ) {
+ $this->wpdb->query(
+ $this->wpdb->prepare(
+ "UPDATE " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "member_info
+ SET email = %s
+ WHERE member = ( SELECT id
+ FROM " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "members
+ WHERE old_member_id = %d
+ )",
+ $email,
+ $member['id']
+ )
+ );
+ }
+ }
+
+ break;
+
case 'import_connections':
// Load Member Info Data Class and get info data for later use