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 April 27, 2024 18:10
Alter WooCommerce CSV Export delimiter
<?php
add_filter( 'woocommerce_product_export_delimiter', function ( $delimiter ) {
// set your custom delimiter
$delimiter = '.';
return $delimiter;
} );
@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 / functions.php
Last active February 11, 2024 11:17
Add category to submitted events automatically
<?php
add_action( 'tribe_community_event_created', 'rt_ce_auto_add_cat_for_submission' );
function rt_ce_auto_add_cat_for_submission( $event_id ) {
$tribe_ecp = Tribe__Events__Main::instance();
// replace with your required category ID.
$cat_ids = [ 20 ]; // for multiple values add like this [ 20, 21 ]
wp_add_object_terms( $event_id, $cat_ids, $tribe_ecp->get_event_taxonomy() );
@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
Last active October 15, 2023 08:34
Plain Ticket Meta data on WooCommerce Order data
<?php
add_action( 'woocommerce_order_status_changed', 'etp_modify_saved_order_meta', 10, 2 );
function etp_modify_saved_order_meta( $order_id, $from_status = null ) {
if ( ! class_exists( 'Tribe__Tickets_Plus__Meta' ) ) {
return;
}
$order = wc_get_order( $order_id );
@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.