Skip to content

Commit

Permalink
Merge pull request #2367 from raftaar1191/issues-2366
Browse files Browse the repository at this point in the history
Issues 2366
  • Loading branch information
ravinderk authored Nov 24, 2017
2 parents 90a94a6 + 5392cb9 commit 795acbe
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions includes/admin/upgrades/upgrade-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1822,21 +1822,24 @@ function give_v20_upgrades_donor_name() {
$donor_last_name = Give()->donor_meta->get_meta( $donor->id, '_give_donor_last_name' );

// If first name meta of donor is not created, then create it.
if ( ! $donor_first_name ) {
if ( ! $donor_first_name && isset( $donor_name[0] ) ) {
Give()->donor_meta->add_meta( $donor->id, '_give_donor_first_name', $donor_name[0] );
}

// If last name meta of donor is not created, then create it.
if ( ! $donor_last_name ) {
if ( ! $donor_last_name && isset( $donor_name[1] ) ) {
Give()->donor_meta->add_meta( $donor->id, '_give_donor_last_name', $donor_name[1] );
}

// If Donor is connected with WP User then update user meta.
if ( $donor->user_id ) {
update_user_meta( $donor->user_id, 'first_name', $donor_name[0] );
update_user_meta( $donor->user_id, 'last_name', $donor_name[1] );
if ( isset( $donor_name[0] ) ) {
update_user_meta( $donor->user_id, 'first_name', $donor_name[0] );
}
if ( isset( $donor_name[1] ) ) {
update_user_meta( $donor->user_id, 'last_name', $donor_name[1] );
}
}

}

} else {
Expand Down

0 comments on commit 795acbe

Please sign in to comment.