PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.7.0.14
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.7.0.14
1.8.13.1 1.8.13 1.8.12.3 1.8.12.2 1.8.12.1 1.8.12 1.8.11.3 1.8.11.2 1.8.11.1 1.8.11 1.6.6 1.6.60 1.6.7 1.6.8 1.6.9 1.7.0 1.7.0.1 1.7.0.11 1.7.0.12 1.7.0.14 1.7.0.2 1.7.0.3 1.7.0.5 1.7.0.6 1.7.0.7 All 212 releases
charitable / includes / compat / charitable-woocommerce-compat-functions.php

charitable-woocommerce-compat-functions.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.7.0.14, at includes/compat/charitable-woocommerce-compat-functions.php

42 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Functions to improve compatibility with WooCommerce.
4 *
5 * @package Charitable/Functions/Compatibility
6 * @author David Bisset
7 * @copyright Copyright (c) 2022, WP Charitable LLC
8 * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9 * @since 1.6.37
10 * @version 1.6.37
11 */
12
13 // Exit if accessed directly.
14 if ( ! defined( 'ABSPATH' ) ) {
15 exit;
16 }
17
18 /**
19 * Charitable handles password resets & email verification in the same
20 * way that WooCommerce handles password resets, which results in redirects
21 * not working the way they're expected to.
22 *
23 * To avoid this, Charitable adds a query arg of 'charitable' to the
24 * reset/email verification link. If that query arg is set, WooCommerce's
25 * handler for this kind of request should not be used, instead falling
26 * back to Charitable's.
27 *
28 * @since 1.6.37
29 *
30 * @return void
31 */
32 function charitable_compat_woocommerce_prevent_wc_reset_redirect() {
33 /* This is a password reset. */
34 if ( isset( $_GET['key'] ) && ( isset( $_GET['id'] ) || isset( $_GET['login'] ) ) ) {
35 if ( isset( $_GET['charitable'] ) ) {
36 remove_action( 'template_redirect', array( 'WC_Form_Handler', 'redirect_reset_password_link' ) );
37 }
38 }
39 }
40
41 add_action( 'template_redirect', 'charitable_compat_woocommerce_prevent_wc_reset_redirect', 1 );
42