PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.9
GiveWP – Donation Plugin and Fundraising Platform v4.16.9
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 2.30.0 All 255 releases
← All changes | includes/actions.php +25 -9 2.30.04.16.9 View file →
@@ -97,13 +97,18 @@
97 97 *
98 98 * @param int $user_id User ID.
99 99 * @param array $user_data User Data.
100 100 *
101 + * @since 4.16.6 Only auto-link when registered via the donation-checkout flow.
101 102 * @since 1.7
102 103 *
103 104 * @return void
104 105 */
105 106 function give_connect_donor_to_wpuser( $user_id, $user_data ) {
107 + if ( empty( $user_data['give_donation_checkout_registration'] ) ) {
108 + return;
109 + }
110 +
106 111 /* @var Give_Donor $donor */
107 112 $donor = new Give_Donor( $user_data['user_email'] );
108 113
109 114 // Validate donor id and check if do nor is already connect to wp user or not.
@@ -212,8 +217,10 @@
212 217
213 218 /**
214 219 * Verify addon dependency before addon update
215 220 *
221 + * @since 4.9.0 rename function - PHP 8 compatibility
222 + * @since 4.1.0 add bailout for GiveWP to protect it from licensing issues
216 223 * @since 2.1.4
217 224 *
218 225 * @param $error
219 226 * @param $hook_extra
@@ -219,9 +226,9 @@
219 226 * @param $hook_extra
220 227 *
221 228 * @return WP_Error
222 229 */
223 -function __give_verify_addon_dependency_before_update( $error, $hook_extra ) {
230 +function give_verify_addon_dependency_before_update( $error, $hook_extra ) {
224 231 // Bailout.
225 232 if (
226 233 is_wp_error( $error )
227 234 || ! array_key_exists( 'plugin', $hook_extra )
@@ -228,9 +235,15 @@
228 235 ) {
229 236 return $error;
230 237 }
231 238
232 - $plugin_base = strtolower( $hook_extra['plugin'] );
239 + // If the plugin is GiveWP then bypass the License check altogether. If there's a problem with licensing it's
240 + // important that we can always upgrade GiveWP.
241 + $plugin_base = strtolower( $hook_extra['plugin'] );
242 + if ( GIVE_PLUGIN_BASENAME === $plugin_base ) {
243 + return $error;
244 + }
245 +
233 246 $licensed_addon = array_map( 'strtolower', Give_License::get_licensed_addons() );
234 247
235 248 // Skip if not a Give addon.
236 249 if ( ! in_array( $plugin_base, $licensed_addon ) ) {
@@ -262,13 +275,14 @@
262 275
263 276 return $error;
264 277 }
265 278
266 -add_filter( 'upgrader_pre_install', '__give_verify_addon_dependency_before_update', 10, 2 );
279 +add_filter( 'upgrader_pre_install', 'give_verify_addon_dependency_before_update', 10, 2 );
267 280
268 281 /**
269 282 * Function to add suppress_filters param if WPML add-on is activated.
270 283 *
284 + * @since 4.9.0 rename function - PHP 8 compatibility
271 285 * @since 2.1.4
272 286 *
273 287 * @param array WP query argument for Total Goal.
274 288 *
@@ -273,9 +287,9 @@
273 287 * @param array WP query argument for Total Goal.
274 288 *
275 289 * @return array WP query argument for Total Goal.
276 290 */
277 -function __give_wpml_total_goal_shortcode_agrs( $args ) {
291 +function give_wpml_total_goal_shortcode_agrs( $args ) {
278 292 $args['suppress_filters'] = true;
279 293
280 294 return $args;
281 295 }
@@ -282,12 +296,13 @@
282 296
283 297 /**
284 298 * Function to remove WPML post where filter in goal total amount shortcode.
285 299 *
300 + * @since 4.9.0 rename function - PHP 8 compatibility
286 301 * @since 2.1.4
287 302 * @global SitePress $sitepress
288 303 */
289 -function __give_remove_wpml_parse_query_filter() {
304 +function give_remove_wpml_parse_query_filter() {
290 305 global $sitepress;
291 306 remove_action( 'parse_query', [ $sitepress, 'parse_query' ] );
292 307 }
293 308
@@ -294,12 +309,13 @@
294 309
295 310 /**
296 311 * Function to add WPML post where filter in goal total amount shortcode.
297 312 *
313 + * @since 4.9.0 rename function - PHP 8 compatibility
298 314 * @since 2.1.4
299 315 * @global SitePress $sitepress
300 316 */
301 -function __give_add_wpml_parse_query_filter() {
317 +function give_add_wpml_parse_query_filter() {
302 318 global $sitepress;
303 319 add_action( 'parse_query', [ $sitepress, 'parse_query' ] );
304 320 }
305 321
@@ -314,13 +330,13 @@
314 330 }
315 331
316 332 if ( is_plugin_active( 'sitepress-multilingual-cms/sitepress.php' ) ) {
317 333
318 - add_filter( 'give_totals_goal_shortcode_query_args', '__give_wpml_total_goal_shortcode_agrs' );
334 + add_filter( 'give_totals_goal_shortcode_query_args', 'give_wpml_total_goal_shortcode_agrs');
319 335
320 336 // @see https://wpml.org/forums/topic/problem-with-query-filter-in-get_posts-function/#post-271309
321 - add_action( 'give_totals_goal_shortcode_before_render', '__give_remove_wpml_parse_query_filter', 99 );
322 - add_action( 'give_totals_goal_shortcode_after_render', '__give_add_wpml_parse_query_filter', 99 );
337 + add_action( 'give_totals_goal_shortcode_before_render', 'give_remove_wpml_parse_query_filter', 99 );
338 + add_action( 'give_totals_goal_shortcode_after_render', 'give_add_wpml_parse_query_filter', 99 );
323 339 }
324 340 }
325 341
326 342 add_action( 'give_init', 'give_add_support_for_wpml', 1000 );