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 June 3, 2020 18:47
Reset deleted count for RSVP tickets when all attendees and tickets are removed
<?php
/**
* Custom reset for attendee deletion count if all attendees are deleted
*/
add_action( 'tickets_rsvp_ticket_deleted', 'rt_reset_deleted_data_if_attendee_not_available', 20, 3 );
function rt_reset_deleted_data_if_attendee_not_available( $ticket_id, $event_id, $product_id ) {
$total_attendees = Tribe__Tickets__Tickets::get_event_attendees_count( $event_id );
@rafsuntaskin
rafsuntaskin / functions.php
Created May 15, 2020 20:14
Custom login URL for RSVP and Tickets
<?php
/**
* Filter default login URL for Tickets and RSVP
*/
add_filter( 'tribe_tickets_ticket_login_url', 'rt_et_custom_login_url' );
function rt_et_custom_login_url( $url ) {
$parts = wp_parse_url( $url );
@rafsuntaskin
rafsuntaskin / functions.php
Created May 1, 2020 22:08
change livestream label for Online Events Control extension
<?php
add_filter( 'tribe_ext_events_control_online_label', function( $label ) {
return 'FaceBook';
}, 10, 1 );
@rafsuntaskin
rafsuntaskin / functions.php
Last active April 29, 2020 17:42
Add Custom CE field in profile to allow direct publish by user
<?php
/**
* Add Custom Field in User Profile to allow Direct Publish for Community Events
*
* @author rafsuntaskin (Rafsun Chowhdury)
*
* @link https://gist.github.com/rafsuntaskin/3df62757dd2bec6694ac47e285b2ee4b
*
*/
@rafsuntaskin
rafsuntaskin / functions.php
Created April 27, 2020 09:22
remove Event description from required fields
<?php
add_filter( 'tribe_events_community_required_fields', 'my_community_required_fields', 10, 1 );
function my_community_required_fields( $fields ) {
if ( ! is_array( $fields ) ) {
return $fields;
}
@rafsuntaskin
rafsuntaskin / functions.php
Last active April 17, 2020 19:16
Remove unwanted body class from non event pages
<?php
add_action( 'wp', 'rt_remove_unwanted_body_class', 90 );
function rt_remove_unwanted_body_class() {
if ( ! tribe_is_event() ) {
remove_filter( 'body_class', [ tribe( Tribe\Events\Views\V2\Hooks::class ), 'filter_body_class' ] );
remove_action( 'wp_footer', [ tribe( 'asset.data' ), 'render_json' ] );
}
}
@rafsuntaskin
rafsuntaskin / functions.php
Last active March 23, 2020 11:18
Community Events redirect to custom login
<?php
add_action( 'tribe_events_community_event_submission_login_form', 'rt_ce_custom_login_redirect', 10 );
add_action( 'tribe_tribe_events_community_event_list_login_form', 'rt_ce_custom_login_redirect', 10 );
function rt_ce_custom_login_redirect() {
$redirect_url = site_url(); //replace site_url with your login url i.e "mywebsite.com/login"
wp_safe_redirect( $redirect_url );
}
@rafsuntaskin
rafsuntaskin / test.json
Last active March 17, 2020 16:14
test.json
[
{
"name": "",
"date": "",
"tec": "",
"pro": "",
"fib": "",
"ebt": "",
"apm": "",
"eti": "",
@rafsuntaskin
rafsuntaskin / functions.php
Last active June 4, 2020 10:16
FIx TribeCommerce payment redirection to Homepage ET 4.11.0+
<?php
add_filter( 'tribe_tickets_checkout_urls', 'rt_tc_add_slash_in_url', 20 );
add_filter( 'tribe_tickets_cart_urls', 'rt_tc_add_slash_in_url', 20 );
add_filter( 'tribe_tickets_tribe-commerce_cart_url', 'rt_tc_add_slash_in_url', 20 );
function rt_tc_add_slash_in_url( $urls ) {
if ( is_array( $urls ) && isset( $urls['Tribe__Tickets__Commerce__PayPal__Main'] ) ) {
$urls['Tribe__Tickets__Commerce__PayPal__Main'] = $urls['Tribe__Tickets__Commerce__PayPal__Main']. '/';
@rafsuntaskin
rafsuntaskin / functions.php
Created March 12, 2020 15:54
remove Provider URL from Woo Checkout URL fix for ET 4.11.4
<?php
//remove the original filter
add_action( 'wp', 'rt_et_remove_tribe_filter', 99 );
function rt_et_remove_tribe_filter() {
$woo_cart = tribe( 'tickets-plus.commerce.woo.cart' );
remove_filter( 'woocommerce_get_checkout_url', [
$woo_cart,
'maybe_filter_checkout_url_to_attendee_registration'