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
Created September 25, 2020 06:51
Add notice for PayPal email save on Payment Form for Community Tickets
<?php
add_action( 'tribe_community_tickets_before_the_payment_options', function () {
if ( ! isset( $_POST['paypal_account_email'] ) ) {
return;
}
$meta = Tribe__Events__Community__Tickets__Payment_Options_Form::get_meta( get_current_user_id() );
@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 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 / functions.php
Created August 25, 2020 21:50
Allow HTML in ticket description
<?php
// Allow (safe) HTML for ticket descriptions.
add_action( 'event_tickets_after_save_ticket', function( $post_id, $ticket, $raw_data, $class ) {
$post = get_post( $ticket->ID, ARRAY_A );
$post['post_excerpt'] = $raw_data['ticket_description'];
wp_update_post( $post );
}, 20, 4 );
@rafsuntaskin
rafsuntaskin / functions.php
Created August 24, 2020 21:37
Remove ET block editor template
<?php
add_action( 'wp_loaded', 'rt_et_remove_default_block_editor_template', 99 );
function rt_et_remove_default_block_editor_template(){
remove_action( 'admin_init', array( tribe('tickets.editor'), 'add_tickets_block_in_editor' ) );
}
@rafsuntaskin
rafsuntaskin / functions.php
Created August 24, 2020 20:26
Avoid default qty if more than 1 ticket
<?php
add_filter( 'tribe_ext_set_default_qty_load_js', function ( $should_load ) {
$post = get_post();
if ( empty( $post ) ) {
return $should_load;
}
@rafsuntaskin
rafsuntaskin / functions.php
Created August 21, 2020 21:55
ET attendee report add Event Schedule
<?php
add_action( 'init', 'rt_et_add_event_schedule_for_attendee_report', 99 );
function rt_et_add_event_schedule_for_attendee_report() {
remove_action( 'tribe_tickets_attendees_event_details_list_top', [
Tribe__Events__Event_Tickets__Main::instance()->attendees_report(),
'event_details_top',
] );
@rafsuntaskin
rafsuntaskin / functions.php
Created August 13, 2020 11:04
Woo ET Force Attendee Regeneration
<?php
//add Order action
add_filter( 'woocommerce_order_actions', 'rt_add_regenerate_action_for_et' );
function rt_add_regenerate_action_for_et( $actions ) {
$actions['tribe_force_regenerate_ticket'] = __( 'Regenerate Attendees' );
return $actions;
}
@rafsuntaskin
rafsuntaskin / functions.php
Created August 5, 2020 20:36
Adding Ticket/RSVP description in Ticket Email for Event Tickets
<?php
/**
* Add Ticket Description in the Ticket Email
*/
add_action( 'tribe_tickets_ticket_email_after_details', 'rt_render_ticket_desc_in_email', 10, 2 );
function rt_render_ticket_desc_in_email( $ticket, $event ) {
@rafsuntaskin
rafsuntaskin / functions.php
Created June 10, 2020 21:59
set ticket purchase limit
<?php
add_filter( 'tribe_tickets_get_ticket_max_purchase', 'rt_limit_max_purchase_et', 20, 2 );
function rt_limit_max_purchase_et( $limit, $ticket ) {
$new_limit = 5;
if ( $limit < $new_limit ) {
return $limit;