• Roundup WP
  • Products
    • Registrations for the Events Calendar Pro – WordPress Event Registration
      • Buy Now
      • Setup (Pro)
      • Demo
    • Stripe Extension
      • Buy Now
      • Setup
    • Mailchimp Extension
      • Buy Now
      • Setup
    • RTEC Memberships
      • Getting Started
    • RTEC WooCommerce Payments
    • Mollie (iDEAL) Extension
      • Buy Now
      • Setup
    • Discount Codes Extension
      • Buy Now
      • Setup
  • Pricing
  • Features
    • Payments
    • Form Builder
    • Email Messages
    • Registration Management
    • Memberships
    • Event Specific
  • Blog
  • Support
    • FAQs and Troubleshooting
    • Codex
    • Contact Support
  • My Account
  • Get Started

Filter: rtec_event_meta

Last updated on August 9, 2017

rtec_event_meta is a filter for the event_meta array before it’s returned by the function “rtec_event_meta”. It accepts an argument of the event_meta that has been created based on the event’s settings.

Usage

<?php add_filter( 'rtec_event_meta', 'function_name' ); ?>

Changelog

Pro
1.3 – introduced

Free
2.0 – introduced

Example: No Registration Limit for Logged-in Users

function ru_filter_event_meta( $event_meta ) {

	if ( is_user_logged_in() ) {
		$event_meta['limit_registrations'] = false;
	}

	return $event_meta;
}
add_filter( 'rtec_event_meta', 'ru_filter_event_meta' );

Example: Disable Registration for Events in a Category

function ru_disable_per_category( $event_meta ) {
	if ( is_admin() ) {
		return $event_meta;
	}

	$disabled_cat = 4; // Term ID for target category.

	$tax   = 'tribe_events_cat';
	$terms = get_the_terms( $event_meta['post_id'], $tax );
	if ( empty( $terms ) ) {
		return $event_meta;
	}

	$ids = array();
	foreach ( $terms as $term ) {
		$ids[] = $term->term_id;
	}

	if ( in_array( $disabled_cat, $ids, true ) ) {
		$event_meta['registrations_disabled'] = true;
		return $event_meta;
	}

	return $event_meta;
}
add_filter( 'rtec_event_meta', 'ru_disable_per_category' );

Example: Logged-in users can only register for one event in a category

function ru_one_per_category( $event_meta ) {
    if ( is_admin() ) {
        return $event_meta;
    }

	if ( is_user_logged_in() ) {
        $tax = 'tribe_events_cat';
	    $terms = get_the_terms( $event_meta['post_id'], $tax );
	    if ( empty( $terms ) ) {
	        return $event_meta;
        }
		$post_type = defined('Tribe__Events__Main::POSTTYPE') ? Tribe__Events__Main::POSTTYPE : 'tribe_events';
		$args = array(
			'post_type'      => $post_type,
			'post_status'    => 'publish',
			'posts_per_page' => 50,
			'order'          => 'ASC'
		);

		$ids = array();
	    foreach( $terms as $term ) {
		    $ids[] = $term->term_id;

        }

		$args['tax_query'] = array(
			array(
				'taxonomy' => $tax,
				'field'    => 'id',
				'terms'    => $ids
			)
		);
		$posts = tribe_get_events( $args );
		
		$event_ids = array();
		foreach ( $posts as $post ) {
			$event_ids[] = $post->ID;
        }

		$rtec = RTEC();
		foreach ( $event_ids as $event_id ) {
			$args = array(
				'fields' => array( 'id' ),
				'where' => array(
					array( 'event_id', $event_id, '=', 'int' ),
					array( 'user_id', get_current_user_id(), '=', 'int' )
				),
				'order_by' => 'registration_date'
			);

			$registrations = $rtec->db_frontend->retrieve_entries( $args, true );

			if ( isset( $registrations[0] ) ) {
				$event_meta['registrations_disabled'] = true;
            }
		}

	}

	return $event_meta;
}
add_filter( 'rtec_event_meta', 'ru_one_per_category' );
Company
  • About
  • Contact
  • Careers
Products
  • Registrations for the Events Calendar
  • Stripe Payments (extension)
  • Mailchimp Email Lists (extension)
  • Event Memberships (extension)
  • WooCommerce Payments (extension)
  • Mollie iDEAL Payments (extension)
  • Discount Codes (extension)
Features
  • Form Builder
  • Event Registration Payments
  • Membership Features
  • Email Messaging
  • Registration Management
  • Event Specific
Resources
  • Support
  • My Account
  • Documentation
  • Pricing
  • Blog
Connect with Us
Follow us on Facebook Contact Us
Copyright © 2025 Roundup WP LLC
Terms & Conditions Privacy Policy Roundup WP Coupon Codes