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/1716 #1740

Merged
merged 6 commits into from
May 26, 2017
Merged

Issue/1716 #1740

merged 6 commits into from
May 26, 2017

Conversation

mehul0810
Copy link
Contributor

Description

This PR is for #1716

How Has This Been Tested?

I've tested this on donation detail page as well as donation listing page with the below scenarios:

  1. Donor name entered on donation form and donor name stored in WP_User are same
  • In this case it will display Mehul Gohil on Donation listing page
  1. Donor name entered on donation form and donor name stored in WP_User are different
  • In this case it will display John Doe (Mehul Gohil) on Donation listing page where Mehul Gohil is linked with WP_User profile

Screenshots (jpeg or gifs if applicable):

donor_name_change_on_listing

Types of changes

Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows has proper inline documentation.

@@ -538,14 +538,28 @@ public function get_payment_id( $payment ) {
*/
public function get_donor( $payment ) {

$customer_id = give_get_payment_customer_id( $payment->ID );
$customer_id = give_get_payment_customer_id( $payment->ID );
Copy link
Collaborator

Choose a reason for hiding this comment

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

@mehul0810 instead of $customer_id, update it to $donor_id

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ravinderk changed naming terminology as per your suggestion

@@ -538,14 +538,28 @@ public function get_payment_id( $payment ) {
*/
public function get_donor( $payment ) {

$customer_id = give_get_payment_customer_id( $payment->ID );
$customer_id = give_get_payment_customer_id( $payment->ID );
$donor_name = give_get_donor_name_by( $payment->ID, 'donation');
Copy link
Collaborator

Choose a reason for hiding this comment

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

@mehul0810 $donor_name should be $donor_billing_name

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ravinderk changed naming terminology as per your suggestion

$customer_id = give_get_payment_customer_id( $payment->ID );
$customer_id = give_get_payment_customer_id( $payment->ID );
$donor_name = give_get_donor_name_by( $payment->ID, 'donation');
$customer_name = give_get_donor_name_by( $customer_id, 'donor');
Copy link
Collaborator

Choose a reason for hiding this comment

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

@mehul0810 $customer_name should be $donor_name

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ravinderk changed naming terminology as per your suggestion

* Retrieves the donor name based on the id and the name of the user or donation
*
* @access public
* @since 1.0
Copy link
Collaborator

Choose a reason for hiding this comment

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

@mehul0810 @since must say 1.8.8

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ravinderk This is a minor issue which is missed. However, i'll make sure that this will be double checked by me next time submitting a PR.

* @param int $id The ID of donation or donor
* @param string $from From will be a string to be passed as donation or donor
*
* @return array
Copy link
Collaborator

Choose a reason for hiding this comment

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

@mehul0810 this function must return string

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ravinderk This is a minor issue which is missed. However, i'll make sure that this will be double checked by me next time submitting a PR.

case 'donation':

$user_info = give_get_payment_meta_user_info( $id );
$name = $user_info['first_name'] . ' ' . $user_info['last_name'];
Copy link
Collaborator

Choose a reason for hiding this comment

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

@mehul0810 use trim function on $name because it is not necessary that donor will have last name, so we do not want to add space after name

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ravinderk Used trim while returning the $name string

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ravinderk This is a minor issue which need to be taken care of. However, while coding i'll make sure that the string can contain spaces and there are possibilities of using trim when the string is filled by an actual user.


case 'donor':

$customer = new Give_Customer( $id );
Copy link
Collaborator

Choose a reason for hiding this comment

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

@mehul0810 start using donor term instead of customer

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ravinderk Sure. I'll make sure of that now.

@@ -512,7 +512,17 @@
<div class="column">
<p>
<strong><?php esc_html_e( 'Donor Name:', 'give' ); ?></strong><br>
<?php echo $customer->name; ?>
<?php
$donor_name = give_get_donor_name_by( $payment_id, 'donation' );
Copy link
Collaborator

Choose a reason for hiding this comment

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

@mehul0810 $donor_name should be $donor_billing_name

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ravinderk changed naming terminology as per your suggestion

<?php echo $customer->name; ?>
<?php
$donor_name = give_get_donor_name_by( $payment_id, 'donation' );
$customer_name = give_get_donor_name_by( $customer_id, 'donor' );
Copy link
Collaborator

Choose a reason for hiding this comment

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

@mehul0810 $customer_name should be $donor_name

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ravinderk changed naming terminology as per your suggestion

$customer_name = give_get_donor_name_by( $customer_id, 'donor' );

// Check whether the donor name and WP_User name is same or not.
if( sanitize_title( $donor_name ) != sanitize_title( $customer_name ) ){
Copy link
Collaborator

Choose a reason for hiding this comment

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

@mehul0810 output donor billing name + donor name

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ravinderk Updated code with outputing donor billing name + donor name on detail page as well and similar to listing page

@DevinWalker DevinWalker merged commit 6207441 into impress-org:release/1.8.9 May 26, 2017
@mehul0810 mehul0810 deleted the issue/1716 branch December 8, 2017 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants