PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.17.0
GiveWP – Donation Plugin and Fundraising Platform v4.17.0
4.17.0 4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 All 256 releases
← All changes | includes/admin/donors/donor-functions.php +20 -29 2.3.0 → 4.17.0 View file →
@@ -3,9 +3,9 @@
3 3 * Donors
4 4 *
5 5 * @package Give
6 6 * @subpackage Admin/Donors
7 - * @copyright Copyright (c) 2016, WordImpress
7 + * @copyright Copyright (c) 2016, GiveWP
8 8 * @license https://opensource.org/licenses/gpl-license GNU Public License
9 9 * @since 1.0
10 10 */
11 11
@@ -25,11 +25,11 @@
25 25 */
26 26 function give_register_default_donor_views( $views ) {
27 27
28 28 $default_views = array(
29 - 'overview' => 'give_donor_view',
30 - 'delete' => 'give_donor_delete_view',
31 - 'notes' => 'give_donor_notes_view',
29 + 'legacy-overview' => 'give_donor_view',
30 + 'legacy-delete' => 'give_donor_delete_view',
31 + 'legacy-notes' => 'give_donor_notes_view',
32 32 );
33 33
34 34 return array_merge( $views, $default_views );
35 35
@@ -48,15 +48,13 @@
48 48 */
49 49 function give_register_default_donor_tabs( $tabs ) {
50 50
51 51 $default_tabs = array(
52 - 'overview' => array(
53 - 'dashicon' => 'dashicons-admin-users',
54 - 'title' => __( 'Donor Profile', 'give' ),
52 + 'legacy-overview' => array(
53 + 'title' => __( 'Donor Profile', 'give' ),
55 54 ),
56 - 'notes' => array(
57 - 'dashicon' => 'dashicons-admin-comments',
58 - 'title' => __( 'Donor Notes', 'give' ),
55 + 'legacy-notes' => array(
56 + 'title' => __( 'Donor Notes', 'give' ),
59 57 ),
60 58 );
61 59
62 60 return array_merge( $tabs, $default_tabs );
@@ -74,11 +72,10 @@
74 72 * @return array The altered list of tabs, with 'delete' at the bottom.
75 73 */
76 74 function give_register_delete_donor_tab( $tabs ) {
77 75
78 - $tabs['delete'] = array(
79 - 'dashicon' => 'dashicons-trash',
80 - 'title' => __( 'Delete Donor', 'give' ),
76 + $tabs['legacy-delete'] = array(
77 + 'title' => __( 'Delete Donor', 'give' ),
81 78 );
82 79
83 80 return $tabs;
84 81 }
@@ -99,10 +96,9 @@
99 96 * @return array
100 97 */
101 98 function give_connect_user_donor_profile( $donor, $donor_data, $address ) {
102 99
103 - $donor_id = $donor->id;
104 - $previous_user_id = $donor->user_id;
100 + $donor_id = $donor->id;
105 101
106 102 /**
107 103 * Fires before editing a donor.
108 104 *
@@ -118,23 +114,18 @@
118 114
119 115 if ( $donor->update( $donor_data ) ) {
120 116
121 117 // Create and Update Donor First Name and Last Name in Meta Fields.
122 - $donor->update_meta( '_give_donor_first_name', $donor_data['first_name'] );
123 - $donor->update_meta( '_give_donor_last_name', $donor_data['last_name'] );
124 - $donor->update_meta( '_give_donor_title_prefix', $donor_data['title'] );
118 + if ( ! empty( $donor_data['first_name'] ) ) {
119 + $donor->update_meta( '_give_donor_first_name', $donor_data['first_name'] );
120 + }
125 121
126 - // Fetch disconnected user id, if exists.
127 - $disconnected_user_id = $donor->get_meta( '_give_disconnected_user_id', true );
122 + if ( isset( $donor_data['last_name'] ) ) {
123 + $donor->update_meta( '_give_donor_last_name', $donor_data['last_name'] );
124 + }
128 125
129 - // Flag User and Donor Disconnection.
130 - delete_user_meta( $disconnected_user_id, '_give_is_donor_disconnected' );
131 -
132 - // Check whether the disconnected user id and the reconnected user id are same or not.
133 - // If both are same then delete user id store in donor meta.
134 - if ( $donor_data['user_id'] === $disconnected_user_id ) {
135 - delete_user_meta( $disconnected_user_id, '_give_disconnected_donor_id' );
136 - $donor->delete_meta( '_give_disconnected_user_id' );
126 + if ( isset( $donor_data['title'] ) ) {
127 + $donor->update_meta( '_give_donor_title_prefix', $donor_data['title'] );
137 128 }
138 129
139 130 $output['success'] = true;
140 131 $donor_data = array_merge( $donor_data, $address );
@@ -190,9 +181,9 @@
190 181 // Delete Donor.
191 182 $donor_deleted = Give()->donors->delete( $donor->id );
192 183
193 184 // Fetch linked donations of a particular donor.
194 - $donation_ids = explode( ',', $donor->payment_ids );
185 + $donation_ids = explode( ',', $donor->payment_ids );
195 186
196 187 // Proceed to delete related donation, if user opted and donor is deleted successfully.
197 188 if ( $donor_deleted && $args['delete_donation'] ) {
198 189 foreach ( $donation_ids as $donation_id ) {