Skip to content

Instantly share code, notes, and snippets.

View rafsuntaskin's full-sized avatar
🎯
Focusing

Rafsun Chowdhury rafsuntaskin

🎯
Focusing
View GitHub Profile
@rafsuntaskin
rafsuntaskin / functions.php
Last active March 4, 2024 22:33
CSV export patch for checkboxes
<?php
add_filter( 'tribe_events_tickets_attendees_table_column', 'tec_et_csv_override_checkbox_patch', 99, 3 );
function tec_et_csv_override_checkbox_patch( $existing, $item, $column ) {
$meta_data = get_post_meta( $item['attendee_id'], Tribe__Tickets_Plus__Meta::META_KEY, true );
/**
* Allow plugins to remove support for checkbox field values being displayed or override the text shown.
*
* @since 4.10.4
@rafsuntaskin
rafsuntaskin / functions.php
Last active February 20, 2024 19:22
Avoid hiding unlisted events from ETP App
<?php
add_filter(
'tribe_events_archive_get_args',
function ( $args, $data, $request ) {
// If the API key is present that means the request is coming from App and we should not hide upcoming events.
if ( isset( $request['api_key'] ) ) {
$args['hide_upcoming'] = false;
// Include private events in the response.
$args['status'] = [ 'publish', 'private' ];
@rafsuntaskin
rafsuntaskin / et-fatal-test.php
Last active January 24, 2024 17:12
ET 5.8.0 Fatal generator
<?php
/**
* Plugin Name: ET Fatal Test Plugin
* Description: Testing ET 5.8.0 fatal with 3rd party integrations
*/
defined( 'ABSPATH' ) || exit;
add_action(
'template_redirect',
@rafsuntaskin
rafsuntaskin / functions.php
Created October 19, 2023 07:58
Disable Ticket Emails JSON LD schema output
<?php
add_filter( 'tec_tickets_emails_template_args', function( $args ) {
if ( isset( $args['json_ld'] ) ) {
unset( $args['json_ld'] );
}
return $args;
} );
@rafsuntaskin
rafsuntaskin / functions.php
Created September 6, 2023 10:24
Create attendee by ticket id
<?php
$ticket_id = 999;
$provider = tribe_tickets_get_ticket_provider( $ticket_id );
$attendee_data = [
'title' => 'Generated Attendee 1',
'full_name' => 'A test attendee',
'email' => 'attendee@test.com',
];
@rafsuntaskin
rafsuntaskin / functions.php
Last active August 14, 2023 12:53
tribe_attendees query
<?php
$tribe_attendees = tribe_attendees('restv1')->where( 'event', $post_id )->where( 'order_status', 'public' )->fields( 'ids' )->all();
?>
//Generated SQL
SELECT
wp_posts.ID
FROM
@rafsuntaskin
rafsuntaskin / functions.php
Last active June 1, 2023 17:01
cache buster for AR page and TC Checkout on pantheo
<?php
add_action( 'init', 'rt_et_bust_cache_varnish_pantheon' );
function rt_et_bust_cache_varnish_pantheon() {
/*
* Set or replace $regex_path_patterns accordingly.
*
* We don't set this variable for you, so you must define it
* yourself per your specific use case before the following conditional.
@rafsuntaskin
rafsuntaskin / functions.php
Created April 5, 2023 20:33
Disable Attendee count Glance item on Admin Dashboard from Event Tickets
<?php
add_action( 'plugins_loaded', function () {
tribe_singleton( TEC\Tickets\Admin\Glance_Items::class, TEC\Tickets\Admin\Glance_Items::class);
}, 1 );
add_action( 'admin_init', function() {
remove_filter( 'dashboard_glance_items', [ tribe( TEC\Tickets\Admin\Glance_Items::class ), 'custom_glance_items_attendees' ], 10 );
}, 20 );
@rafsuntaskin
rafsuntaskin / functions.php
Created January 11, 2023 10:09
Workaround for JSON error on Sage theme with AR Page
<?php
/**
* This is a workaround to make AR page work with Sage theme JSON errors.
*
* Under Tickets > Settings > Attendee Registration
* -> Set Attendee Registration Slug to 'attendee-registration'
* -> Don't choose any page.
* -> Now create a Page with the shortcode [tribe_attendee_registration] and use the slug `attendee-registration-info` for that page.
* -> Then just copy and paste this code in your theme's functions.php file.
@rafsuntaskin
rafsuntaskin / functions.php
Created November 24, 2022 16:40
TicketsCommerce PayPal SDK locale fix
<?php
add_filter( 'tec_tickets_commerce_gateway_paypal_merchant_locale', function() {
return 'en_US';
} );