Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue/1131 #1135

Merged
merged 2 commits into from
Oct 19, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions includes/admin/customers/customer-actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,11 @@ function give_edit_customer( $args ) {

$defaults = array(
'name' => '',
'email' => '',
'user_id' => 0
);

$customer_info = wp_parse_args( $customer_info, $defaults );

if ( ! is_email( $customer_info['email'] ) ) {
give_set_error( 'give-invalid-email', esc_html__( 'Please enter a valid email address.', 'give' ) );
}

if ( (int) $customer_info['user_id'] != (int) $customer->user_id ) {

// Make sure we don't already have this user attached to a customer
Expand Down Expand Up @@ -117,7 +112,6 @@ function give_edit_customer( $args ) {
// Sanitize the inputs
$customer_data = array();
$customer_data['name'] = strip_tags( stripslashes( $customer_info['name'] ) );
$customer_data['email'] = $customer_info['email'];
$customer_data['user_id'] = $customer_info['user_id'];

$customer_data = apply_filters( 'give_edit_customer_info', $customer_data, $customer_id );
Expand All @@ -139,7 +133,6 @@ function give_edit_customer( $args ) {
do_action( 'give_pre_edit_customer', $customer_id, $customer_data, $address );

$output = array();
$previous_email = $customer->email;

if ( $customer->update( $customer_data ) ) {

Expand All @@ -150,12 +143,6 @@ function give_edit_customer( $args ) {
// Update some donation meta if we need to
$payments_array = explode( ',', $customer->payment_ids );

if ( $customer->email != $previous_email ) {
foreach ( $payments_array as $payment_id ) {
give_update_payment_meta( $payment_id, 'email', $customer->email );
}
}

if ( $customer->user_id != $previous_user_id ) {
foreach ( $payments_array as $payment_id ) {
give_update_payment_meta( $payment_id, '_give_payment_user_id', $customer->user_id );
Expand Down