Skip to content

Instantly share code, notes, and snippets.

View masoodahmed's full-sized avatar

Masood Ahmed Khan masoodahmed

View GitHub Profile
@masoodahmed
masoodahmed / change_login_to_purchase_button_url.php
Created August 22, 2025 12:12
Change "Login to purchase" Button URL
<?php //Do not copy this line
add_filter( 'tribe_tickets_ticket_login_url', function ( $login_url ) {
$login_page = '/new_login_page';
return site_url() . $login_page . '?redirect_to=' . urlencode( tribe_get_event()->permalink );
} );
@masoodahmed
masoodahmed / redirect_custom_url_community_event_submission.php
Created July 3, 2025 18:17
Redirect to Custom URL After Community Event Submission
<?php //Do not copy this line
add_action( 'tribe_community_event_save_updated', function ( $event_id ) {
if ( tribe_is_event( $event_id ) ) {
$url = home_url( '/sample-page/' );
// JS redirect allows server processing to complete
echo '<script>window.location.href = "' . esc_url( $url ) . '";</script>';
}
} );
@masoodahmed
masoodahmed / organizer_email_notifications_new_attendees.php
Created June 5, 2025 15:18
Organizer Email Notifications for New Attendees - Event Tickets & Event Tickets Plus
<?php //Do not copy this line
class ET_Event_Organizer_Notification_Manager {
public function __construct() {
// Action hooks for RSVP, WooCommerce, and Tickets Commerce
add_action( 'event_tickets_rsvp_tickets_generated', [ $this, 'handle_rsvp_attendee' ], 10, 2 );
add_action( 'tec_tickets_commerce_flag_action_generated_attendees', [ $this, 'handle_commerce_attendee' ] );
add_action( 'event_ticket_woo_attendee_created', [ $this, 'handle_woo_attendee' ], 10, 2 );
}
@masoodahmed
masoodahmed / prepend_attendee_purchaser_name_pdf_ticket_filename.php
Created May 21, 2025 08:36
Prepend Attendee or Purchaser Name to PDF Ticket Filename
<?php //Do not copy this line
add_filter( 'tec_tickets_wallet_plus_pdf_pass_filename', function ( $filename, $attendee_id ) {
// Get attendee using the ID
$attendees = tribe_tickets_get_attendees( $attendee_id );
// Early return if no attendees found
if ( empty( $attendees ) || ! is_array( $attendees ) ) {
return $filename;
}
@masoodahmed
masoodahmed / sort_events_list_widget_published_date.php
Created March 13, 2025 20:58
Sort Events List Widget by Published Date (Newest First)
<?php //Do not copy this line
class EventsListWidget_NewlyAddedEvents {
protected $constraints = array(
'sidebar_id' => null,
'widget_id' => null,
'widget_title' => null
);
public function __construct( array $constraints = array() ) {
@masoodahmed
masoodahmed / custom_placeholders_tickets_commerce_completed_order_email.php
Created February 20, 2025 15:40
Add Custom Placeholders to Tickets Commerce Completed Order Email
<?php //Do not copy this line
add_filter( 'tec_tickets_emails_completed-order_placeholders', function ( $placeholders, $id, $email ) {
// Ensure the email object contains attendees
$attendees = $email->get( 'attendees' );
if ( empty( $attendees ) || ! is_array( $attendees ) ) {
return $placeholders;
}
@masoodahmed
masoodahmed / prevent_access_events_archive_page.php
Created February 4, 2025 14:49
Prevent Access to Events Archive Page
<?php //Do not copy this line
add_filter( 'tribe_events_rewrite_base_slugs', static function ( array $bases ): array {
$bases['archive'] = [];
return $bases;
} );
@masoodahmed
masoodahmed / set_woocommerce_default_payment_module.php
Created January 23, 2025 13:28
Set WooCommerce as Default Payment Module
<?php //Do not copy this line
add_filter( 'tribe_tickets_get_default_module', function ( $default, $modules ) {
$woocommerce_module = 'Tribe__Tickets_Plus__Commerce__WooCommerce__Main';
// WooCommerce available and not default
if ( in_array( $woocommerce_module, $modules ) && $default !== $woocommerce_module ) {
return $woocommerce_module;
}
@masoodahmed
masoodahmed / add_event_title_column_attendees_export_csv.php
Created January 16, 2025 15:46
Add Event Title Column to Attendees Export CSV
<?php //Do not copy this line
add_filter( 'tribe_events_tickets_attendees_table_column', function ( $value, $item, $column ) {
if ( $column !== 'associated_event' ) {
return $value;
}
if ( ! empty( $item['event_id'] ) ) {
$event = tribe_get_event( $item['event_id'] );
@masoodahmed
masoodahmed / grant_users_permission_manage_attendees.php
Created January 15, 2025 15:49
Grant Specific Users Permission to Manage Attendees
<?php //Do not copy this line
add_filter( 'tribe_tickets_user_can_manage_attendees', function ( $user_can, $user_id ) {
$allowed_user_ids = [ 1 ]; // List of user IDs allowed to manage attendees
if ( in_array( $user_id, $allowed_user_ids, true ) ) {
$user_can = true;
}
return $user_can;