Skip to content

Commit

Permalink
Fix Notices impress-org#2366
Browse files Browse the repository at this point in the history
  • Loading branch information
raftaar1191 committed Nov 21, 2017
1 parent 34fadc2 commit 5392cb9
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 5392cb9

Please sign in to comment.