Givewp: fix: resolve incompatibility with The Events Calendar: Eventbrite Tickets plugin

Created on 30 Oct 2018  Â·  3Comments  Â·  Source: impress-org/givewp

Bug Report

User Story


As a site admin, I want to use both Give and The Events Calendar: Eventbrite Tickets plugin side by side so that I can collect donations and collect tickets.

Current Behavior

Currently, with The Events Calendar: Eventbrite Tickets plugin activated there is donation information not being displayed in the admin side of give. When not signed in as a WordPress User the "Personal Information" section on the form front-end is not displaying.

Expected Behavior

I expect to use both plugins side by side.

Bug Type

  • [ ] I am not sure whether this functionality ever worked as expected.

Steps to Reproduce

  1. Activate The Events Calendar and The Events Calendar: Eventbrite Tickets plugin
  2. View the Donations admin page and see the missing data
  3. View the front-end of a form while signed out and see the missing Personal Information section

Password protected link to each plugin download:
https://drive.google.com/file/d/1Gk0MKd_D44wEa5e_0hzrTZoMjm8FuM40/view?usp=sharing
https://drive.google.com/file/d/1DOCN3rbqCxR-z2aCLjVWNjebDNWOzbP1/view?usp=sharing

Visuals


Admin Screen:
screen shot 2018-10-30 at 10 05 02 am

Form in incognito window:
screen shot 2018-10-30 at 10 05 52 am

Related


https://secure.helpscout.net/conversation/696347261/28212/
https://secure.helpscout.net/conversation/691714929/27812

Acceptance Criteria

  • [ ] The donation information displays when both plugins are activated
  • [ ] The Personal Information section displays when logged out on a form

Environment



Operating System

  • Platform: Mac OS X/li>


Browser

  • Name: Chrome



WordPress System Info

WordPress Environment

Home URL: http://give.local
Site URL: http://give.local
WP Version: 4.9.8
WP Multisite: –
WP Memory Limit: 256 MB
WP Debug Mode: –
WP Cron: âś”
Language: en_US
Permalink Structure: /%postname%/
Show on Front: posts
Table Prefix Length: wp_
Table Prefix Length: 3
Table Prefix Status: Acceptable
Admin AJAX: Accessible
Registered Post Statuses: publish, future, draft, pending, private, trash, auto-draft, inherit, request-pending, request-confirmed, request-failed, request-completed, in-progress, failed, wc-pending, wc-processing, wc-on-hold, wc-completed, wc-cancelled, wc-refunded, wc-failed, refunded, revoked, cancelled, abandoned, processing, preapproval, tribe-ea-success, tribe-ea-failed, tribe-ea-schedule, tribe-ea-pending, tribe-ea-draft, tribe-ignored, give_subscription

Server Environment

Hosting Provider: DBH: localhost, SRV: give.local
TLS Connection: Connection uses TLS 1.2
TLS Connection: Probably Okay
Server Info: Apache/2.4.10 (Debian)
PHP Version: 7.1.4
PHP Post Max Size: 1,000 MB
PHP Time Limit: 900
PHP Max Input Vars: 3000
PHP Max Upload Size: 1,000 MB
cURL Version: ❌ 7.38.0, OpenSSL/1.0.1t - We recommend a minimum cURL version of 7.40.
SUHOSIN Installed: –
MySQL Version: 5.6.34
Default Timezone is UTC: âś”
fsockopen/cURL: âś”
SoapClient: âś”
DOMDocument: âś”
gzip: âś”
GD Graphics Library: âś”
Multibyte String: âś”
Remote Post: âś”
Remote Get: âś”

Give Configuration

Give Version: 2.3.0
Give Cache: Enabled
Database Updates: All DB Updates Completed.
Give Cache: Enabled
Give Cache: ✔New Donation✔Donation Receipt✔New Offline Donation✔Offline Donation Instructions✔New User Registration✔User Registration Information✔Donor Note✔Email access✔Daily Email Report✔Weekly Email Report✔Monthly Email Report✔Renewal Receipt Email✔Subscription Cancelled Email❌Subscription Completed Email✔Subscription Reminder Email✔Subscriptions Email Access
Upgraded From: 2.2.3
Test Mode: Enabled
Currency Code: USD
Currency Position: Before
Decimal Separator: .
Thousands Separator: ,
Success Page: http://give.local/donation-confirmation/
Failure Page: http://give.local/donation-failed/
Donation History Page: http://give.local/donation-history/
Give Forms Slug: /donations/
Enabled Payment Gateways: PayPal Standard, Test Donation, Offline Donation, Stripe - Credit Card
Default Payment Gateway: PayPal Standard
PayPal IPN Verification: Disabled
PayPal IPN Notifications: N/A
Donor Email Access: Enabled

Active Give Add-ons

Give - Authorize.net Gateway: ✔ Licensed – by WordImpress – 1.4.3
Give - Braintree Gateway: ✔ Licensed – by WordImpress – 1.2.2
Give - CCAvenue Gateway: ✔ Licensed – by WordImpress – 1.0.2
Give - Donation Upsells for WooCommerce: ❌ Unlicensed – by WordImpress – 1.0.4
Give - Email Reports: ✔ Licensed – by WordImpress – 1.1.2
Give - Fee Recovery: ❌ Unlicensed – by GiveWP – 1.7.2
Give - Form Field Manager: ❌ Unlicensed – by GiveWP – 1.4.0
Give - Gift Aid: ❌ Unlicensed – by WordImpress – 1.1.6
Give - Google Analytics Donation Tracking: ❌ Unlicensed – by GiveWP – 1.2.1
Give - MailChimp: ✔ Licensed – by WordImpress – 1.4.1
Give - Manual Donations: ✔ Licensed – by WordImpress – 1.4.1
Give - PayPal Pro Gateway: ❌ Unlicensed – by GiveWP – 1.2.0
Give - Paytm Gateway: ✔ Licensed – by WordImpress – 1.0.1
Give - PDF Receipts: ✔ Licensed – by WordImpress – 2.3
Give - Razorpay: ❌ Unlicensed – by WordImpress – 1.2.0
Give - Recurring Donations: ❌ Unlicensed – by GiveWP – 1.8.1
Give - Stripe Gateway: ❌ Unlicensed – by GiveWP – 2.1.1
Give - Tributes: ✔ Licensed – by WordImpress – 1.5.0
Sam's Helper Function: ❌ Unlicensed – by WordImpress – 1.0

Other Active Plugins

Give - Hook Helper: by Ravinder Kumar – 1.0
The Events Calendar: by Modern Tribe, Inc. – 4.6.25
The Events Calendar: Eventbrite Tickets: by Modern Tribe, Inc. – 4.5.5
Transients Manager: by Pippin Williamson – 1.7.5
WooCommerce: by Automattic – 3.5.0

Inactive Plugins

All-in-One WP Migration: by ServMask – 6.78
Contact Form 7: by Takayuki Miyoshi – 5.0.4
Intelligence: by LevelTen – 1.3.1
Invisible reCaptcha: by Mihai Chelaru – 1.2.1
User Role Editor: by Vladimir Garagulya – 4.46
WordPress Importer: by wordpressdotorg – 0.6.4
WP Business Reviews: by Impress.org – 1.0.0

Active MU Plugins

Bypass Login: by Stephen Carnam – 1.1.0

Theme

Name: Twenty Seventeen
Version: 1.7
Author URL: https://wordpress.org/
Child Theme: No – If you're modifying Give on a parent theme you didn't build personally, then we recommend using a child theme. See: How to Create a Child Theme

Most helpful comment

Hello folks—thanks all for your patience! We're hoping to include a fix for this bug into the next upcoming release of Eventbrite Tickets, which if all goes to plan should arrive some time in the next 3–4 weeks.

All 3 comments

I believe the issue is within the-events-calendar-eventbrite-tickets/src/Tribe/Main.php when they are filtering add_filter( 'get_post_metadata', array( $this, 'normalize_get_eventbrite_id' ), 20, 4 ); they are not returning $null within their conditional checks:

// Bail if the key is not `_EventBriteId`
if ( '_EventBriteId' !== $meta_key ) {
    return;
}

// Bail if the post type is not `tribe_events`
if ( 'tribe_events' !== get_post_type( $object_id ) ) {
    return;
}

This is causing our data to not be taken from the database. See: https://codex.wordpress.org/Plugin_API/Filter_Reference/get_(meta_type)_metadata

Return Parameter
The filter must return null if the data should be taken from the database. If it returns anything else, the get_metadata (and therefore the get_user_meta) function will return what the filter returns.

The code should be updated to:

// Bail if the key is not `_EventBriteId`
if ( '_EventBriteId' !== $meta_key ) {
    return $null;
}

// Bail if the post type is not `tribe_events`
if ( 'tribe_events' !== get_post_type( $object_id ) ) {
    return $null;
}

However, it could be something we are doing on our end incorrectly within class-give-db-meta.php but I have to discuss with @ravinderk first before closing this out due to a change necessary on their end.

I say this because if you change the above code to return null from $null the same "Donor missing" result returns and other meta is not pulled like the donor's total given. In the example on WP.org they have the function returning null (not $null):

2018-10-30_12-43-37

And in get_metadate() within wp-includes/meta.php the filter describes that null should work:

/**
     * Filters whether to retrieve metadata of a specific type.
     *
     * The dynamic portion of the hook, `$meta_type`, refers to the meta
     * object type (comment, post, or user). Returning a non-null value
     * will effectively short-circuit the function.
     *
     * @since 3.1.0
     *
     * @param null|array|string $value     The value get_metadata() should return - a single metadata value,
     *                                     or an array of values.
     * @param int               $object_id Object ID.
     * @param string            $meta_key  Meta key.
     * @param bool              $single    Whether to return only the first value of the specified $meta_key.
     */
    $check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, $single );

    if ( null !== $check ) {
        if ( $single && is_array( $check ) )
            return $check[0];
        else
            return $check;
    }

So I need a second opinion from @ravinderk on it.

@DevinWalker I got confirmation from Modern Tribe that they are fixing this in their plugin ASAP.

Hello folks—thanks all for your patience! We're hoping to include a fix for this bug into the next upcoming release of Eventbrite Tickets, which if all goes to plan should arrive some time in the next 3–4 weeks.

Was this page helpful?
0 / 5 - 0 ratings