Tribe__Events__Community__Tickets__Main::user_can_manage_own_event_attendees( boolean $user_can, int $user_id, int $event_id )

Allows event creator to edit attendees if allowUsersToEditSubmissions is true


Parameters #

$user_can

(boolean) (Required) user can/can't edit

$user_id

(int) (Required) ID of user to check, uses current user if empty

$event_id

(int) (Required) Event ID.


Top ↑

Return #

(boolean)


Top ↑

Source #

File: src/Tribe/Main.php

	public function user_can_manage_own_event_attendees( $user_can, $user_id, $event_id ) {
		if ( empty( $user_id ) ) {
			$user_id = get_current_user_id();
		}

		// Cannot manage attendees without user.
		if ( empty( $user_id ) ) {
			return false;
		}

		// Cannot manage attendees without event.
		if ( empty( $event_id ) ) {
			return false;
		}

		// Can manage attendees from admin area.
		if ( is_admin() ) {
			return true;
		}

		// Cannot determine management if origin is not current origin.
		if ( 'community-events' !== get_post_meta( $event_id, '_EventOrigin', true ) )  {
			return $user_can;
		}

		// Cannot manage attendees that they do not own.
		if ( (int) $user_id !== (int) get_post_field( 'post_author', $event_id ) ) {
			return false;
		}

		// Cannot manage attendees if they are not allowed to edit submissions.
		if ( ! tribe( 'community.main' )->getOption( 'allowUsersToEditSubmissions' ) ) {
			return false;
		}

		return true;
	}

Top ↑

Changelog #

Changelog
Version Description
4.6.1 Introduced.