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

Remove Parameter the unwanted parameter #2663 #2687

Merged
merged 15 commits into from
Jan 29, 2018
Merged
Changes from 14 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
14 changes: 6 additions & 8 deletions includes/process-donation.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,18 +181,16 @@ function give_process_donation_form() {
add_action( 'wp_ajax_give_process_donation', 'give_process_donation_form' );
add_action( 'wp_ajax_nopriv_give_process_donation', 'give_process_donation_form' );


/**
* Verify that when a logged in user makes a donation that the email address used doesn't belong to a different customer.
*
* @since 1.7
*
* @param array $valid_data Validated data submitted for the donation.
* @param array $post Additional $_POST data submitted
*
* @return void
*/
function give_check_logged_in_user_for_existing_email( $valid_data, $post ) {
function give_check_logged_in_user_for_existing_email( $valid_data ) {

// Verify that the email address belongs to this customer.
if ( is_user_logged_in() ) {
Expand All @@ -214,7 +212,7 @@ function give_check_logged_in_user_for_existing_email( $valid_data, $post ) {
}
}

add_action( 'give_checkout_error_checks', 'give_check_logged_in_user_for_existing_email', 10, 2 );
add_action( 'give_checkout_error_checks', 'give_check_logged_in_user_for_existing_email', 10, 1 );

/**
* Process the checkout login form
Expand Down Expand Up @@ -1166,18 +1164,18 @@ function give_donation_form_validate_cc_zip( $zip = 0, $country_code = '' ) {
return apply_filters( 'give_is_zip_valid', $ret, $zip, $country_code );
}


/**
* Validate donation amount and auto set correct donation level id on basis of amount.
*
* Note: If amount does not match to donation level amount then level id will be auto select to first match level id on basis of amount.
*
* @param array $valid_data List of Valid Data.
* @param array $data List of Posted Data.
*
* @return bool
*/
function give_validate_donation_amount( $valid_data, $data ) {
function give_validate_donation_amount( $valid_data ) {
$data = $_POST;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@raftaar1191 Do not need to create $data param please use $_POST directly with validation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we are updating the $data and then adding that to DB
That why I am adding $_POST value to $data variable

  1. https://github.com/WordImpress/Give/blob/release/2.0.2/includes/process-donation.php#L1188

  2. https://github.com/WordImpress/Give/blob/release/2.0.2/includes/process-donation.php#L1205

I can update this function but I don't think it's needed. Let me know if you want to to updated it


/* @var Give_Donate_Form $form */
$form = new Give_Donate_Form( $data['give-form-id'] );

Expand Down Expand Up @@ -1234,7 +1232,7 @@ function give_validate_donation_amount( $valid_data, $data ) {
return ( $donation_level_matched ? true : false );
}

add_action( 'give_checkout_error_checks', 'give_validate_donation_amount', 10, 2 );
add_action( 'give_checkout_error_checks', 'give_validate_donation_amount', 10, 1 );

/**
* Validate Required Form Fields.
Expand Down