PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.18.0
GiveWP – Donation Plugin and Fundraising Platform v4.18.0
4.18.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 All 257 releases
← All changes | includes/payments/actions.php +30 -16 2.3.1 → 4.18.0 View file →
@@ -81,8 +81,11 @@
81 81 // Increase the earnings for this form ID.
82 82 give_increase_earnings( $form_id, $amount, $payment_id );
83 83 give_increase_donation_count( $form_id );
84 84
85 + // Update the goal progress for this form ID.
86 + give_update_goal_progress( $form_id );
87 +
85 88 // @todo: Refresh only range related stat cache
86 89 give_delete_donation_stats();
87 90
88 91 // Increase the donor's donation stats.
@@ -131,8 +134,13 @@
131 134 $stati = give_get_payment_statuses();
132 135 $old_status = isset( $stati[ $old_status ] ) ? $stati[ $old_status ] : $old_status;
133 136 $new_status = isset( $stati[ $new_status ] ) ? $stati[ $new_status ] : $new_status;
134 137
138 + // Skip recording payment status change if there is no update
139 + if ( $old_status === $new_status ) {
140 + return;
141 + }
142 +
135 143 // translators: 1: old status 2: new status.
136 144 $status_change = sprintf( esc_html__( 'Status changed from %1$s to %2$s.', 'give' ), $old_status, $new_status );
137 145
138 146 give_insert_payment_note( $payment_id, $status_change );
@@ -162,13 +170,15 @@
162 170 if ( get_option( 'give_payment_totals_upgraded' ) ) {
163 171 return;
164 172 }
165 173
166 - $payments = give_get_payments( array(
167 - 'offset' => 0,
168 - 'number' => - 1,
169 - 'mode' => 'all',
170 - ) );
174 + $payments = give_get_payments(
175 + array(
176 + 'offset' => 0,
177 + 'number' => - 1,
178 + 'mode' => 'all',
179 + )
180 + );
171 181
172 182 if ( $payments ) {
173 183 foreach ( $payments as $payment ) {
174 184
@@ -209,9 +219,9 @@
209 219 remove_filter( 'posts_where', 'give_filter_where_older_than_week' );
210 220
211 221 if ( $payments ) {
212 222 /**
213 - * Filter payment gateways: Used to set payment gateways which can be skip while transferring pending payment to abandon.
223 + * Filter payment gateways: Used to set payment gateways that can be skipped while updating the donation status from pending to abandoned.
214 224 *
215 225 * @since 1.6
216 226 *
217 227 * @param array $skip_payment_gateways Array of payment gateways
@@ -259,8 +269,9 @@
259 269 /**
260 270 * Add support to get all payment meta.
261 271 * Note: only use for internal purpose
262 272 *
273 + * @since 3.19.0 change $donor_data['address'] to array instead of false
263 274 * @since 2.0
264 275 *
265 276 * @param $check
266 277 * @param $object_id
@@ -271,11 +282,10 @@
271 282 */
272 283 function give_bc_v20_get_payment_meta( $check, $object_id, $meta_key, $single ) {
273 284 // Bailout.
274 285 if (
275 - 'give_payment' !== get_post_type( $object_id ) ||
276 - '_give_payment_meta' !== $meta_key ||
277 - ! give_has_upgrade_completed( 'v20_upgrades_payment_metadata' )
286 + 'give_payment' !== get_post_type( $object_id )
287 + || '_give_payment_meta' !== $meta_key
278 288 ) {
279 289 return $check;
280 290 }
281 291
@@ -298,11 +308,14 @@
298 308 return $check;
299 309 }
300 310
301 311 // Convert all meta key value to string instead of array
302 - array_walk( $payment_meta, function ( &$meta, $key ) {
303 - $meta = current( $meta );
304 - } );
312 + array_walk(
313 + $payment_meta,
314 + function ( &$meta, $key ) {
315 + $meta = current( $meta );
316 + }
317 + );
305 318
306 319 /**
307 320 * Add backward compatibility to old meta keys.
308 321 */
@@ -321,9 +334,9 @@
321 334 // Form id.
322 335 $payment_meta['form_id'] = ! empty( $payment_meta['_give_payment_form_id'] ) ? $payment_meta['_give_payment_form_id'] : '';
323 336
324 337 // Price id.
325 - $payment_meta['price_id'] = ! empty( $payment_meta['_give_payment_price_id'] ) ? $payment_meta['_give_payment_price_id'] : '';
338 + $payment_meta['price_id'] = isset( $payment_meta['_give_payment_price_id'] ) ? $payment_meta['_give_payment_price_id'] : '';
326 339
327 340 // Date.
328 341 $payment_meta['date'] = ! empty( $payment_meta['_give_payment_date'] ) ? $payment_meta['_give_payment_date'] : '';
329 342 $payment_meta['date'] = ! empty( $payment_meta['date'] ) ?
@@ -329,9 +342,8 @@
329 342 $payment_meta['date'] = ! empty( $payment_meta['date'] ) ?
330 343 $payment_meta['date'] :
331 344 get_post_field( 'post_date', $object_id );
332 345
333 -
334 346 // Currency.
335 347 $payment_meta['currency'] = ! empty( $payment_meta['_give_payment_currency'] ) ? $payment_meta['_give_payment_currency'] : '';
336 348
337 349 // Decode donor data.
@@ -355,9 +367,9 @@
355 367
356 368 // User ID.
357 369 $donor_data['id'] = $donation->user_id;
358 370
359 - $donor_data['address'] = false;
371 + $donor_data['address'] = [];
360 372
361 373 // Address1.
362 374 $address1 = ! empty( $payment_meta['_give_donor_billing_address1'] ) ? $payment_meta['_give_donor_billing_address1'] : '';
363 375 if ( $address1 ) {
@@ -424,9 +436,11 @@
424 436
425 437 return $payment_meta;
426 438 }
427 439
428 -add_filter( 'get_post_metadata', 'give_bc_v20_get_payment_meta', 999, 4 );
440 +if ( give_has_upgrade_completed( 'v20_upgrades_payment_metadata' ) ) {
441 + add_filter( 'get_post_metadata', 'give_bc_v20_get_payment_meta', 999, 4 );
442 +}
429 443
430 444 /**
431 445 * Add meta in payment that store page id and page url.
432 446 *