Skip to content

Commit

Permalink
Merge pull request #2435 from mehul0810/minorfix/issue/1715
Browse files Browse the repository at this point in the history
Minorfix/issue/1715
  • Loading branch information
ravinderk committed Nov 30, 2017
2 parents e37630f + 259ddbb commit 8a210c3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
15 changes: 11 additions & 4 deletions includes/admin/donors/donor-actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function give_edit_donor( $args ) {
return false;
}

$donor_info = $args['customerinfo'];
$donor_info = give_clean( $args['customerinfo'] );
$donor_id = (int) $args['customerinfo']['id'];
$nonce = $args['_wpnonce'];

Expand Down Expand Up @@ -84,10 +84,17 @@ function give_edit_donor( $args ) {
return false;
}

// If First name of donor is empty, then fetch the current first name of donor.
if ( empty( $donor_info['first_name'] ) ) {
$donor_info['first_name'] = $donor->get_first_name();
}

// Sanitize the inputs.
$donor_data = array();
$donor_data['name'] = strip_tags( stripslashes( $donor_info['name'] ) );
$donor_data['user_id'] = $donor_info['user_id'];
$donor_data = array();
$donor_data['name'] = trim( "{$donor_info['first_name']} {$donor_info['last_name']}" );
$donor_data['first_name'] = $donor_info['first_name'];
$donor_data['last_name'] = $donor_info['last_name'];
$donor_data['user_id'] = $donor_info['user_id'];

$donor_data = apply_filters( 'give_edit_donor_info', $donor_data, $donor_id );

Expand Down
4 changes: 4 additions & 0 deletions includes/admin/donors/donor-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ function give_connect_user_donor_profile( $donor, $donor_data, $address ) {

if ( $donor->update( $donor_data ) ) {

// Create and Update Donor First Name and Last Name in Meta Fields.
$donor->update_meta( '_give_donor_first_name', $donor_data['first_name'] );
$donor->update_meta( '_give_donor_last_name', $donor_data['last_name'] );

// Fetch disconnected user id, if exists.
$disconnected_user_id = $donor->get_meta( '_give_disconnected_user_id', true );

Expand Down

0 comments on commit 8a210c3

Please sign in to comment.