Last active
December 19, 2015 01:38
-
-
Save romulodl/5877065 to your computer and use it in GitHub Desktop.
Tribe evetbrite tickets plugin hack to work with php 5.4 - Edit the file tribe-eventbrite.class.php form the line 1268 to 1302
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function payment_update( $postId, $eventId, $raw_post ) { | |
$paymentTypes = array('check' => '', 'cash' => '', 'invoice' => ''); | |
$requestParams = 'event_id=' . $eventId; | |
// make it accept cash if free & assign a message | |
if ( 2 == $raw_post['EventBriteIsDonation'] ) { | |
$requestParams .= '&accept_cash=1'; | |
$requestParams .= '&instructions_cash=' . urlencode( __( 'This event is free to attend', 'tribe-eventbrite' ) ); | |
} else { | |
// otherwise loop through the payment methods as it's supposed to | |
foreach( $paymentTypes as $key => $val ) { | |
$onOff = $raw_post['EventBritePayment_accept_' . $key]; | |
if ( $onOff ) $requestParams .= '&accept_' . $key . '=' . $onOff; | |
$paymentTypes[$key] = $onOff; | |
} | |
foreach( $paymentTypes as $key => $val ) { | |
if ( $val ) { | |
$instructions = $raw_post['EventBritePayment_instructions_'.$key]; | |
if ( $instructions ) $requestParams .= '&instructions_' . $key . '=' . urlencode( stripslashes( $instructions ) ); | |
} | |
} | |
// Online payment method is either/or (not both) | |
$onlineMethod = $raw_post['EventBritePayment_accept_online']; | |
if ( !empty( $raw_post['EventBritePayment_accept_online'] ) ) { | |
switch( $onlineMethod ) { | |
case 'paypal': | |
$requestParams .= '&accept_paypal=1&paypal_email=' . $raw_post['EventBritePayment_paypal_email']; | |
break; | |
case 'google': | |
$requestParams .= '&accept_google=1&google_merchant_id=' . $raw_post['EventBritePayment_google_merchant_id'] . '&google_merchant_key=' . $raw_post['EventBritePayment_google_merchant_key']; | |
break; | |
} | |
} | |
} | |
$response_arr = self::sendEventBriteRequest( 'payment_update', $requestParams, $postId ); | |
if (WP_DEBUG) error_log("PAYMENT OPTIONS" . print_r($response_arr, true)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment