Tribe__Tickets__Attendees::user_can_manage_attendees( int $user_id,  $event_id = '' )

Determines if the current user (or an ID-specified one) is allowed to delete, check-in, and undo check-in attendees.


Parameters

$user_id

(int) (Optional) The ID of the user whose access we're checking.


Top ↑

Return

(boolean)


Top ↑

Source

File: src/Tribe/Attendees.php

	public function user_can_manage_attendees( $user_id = 0, $event_id = '' ) {
		$user_id = 0 === $user_id ? get_current_user_id() : $user_id;
		$user_can = true;

		// bail quickly here as we don't have a user to check
		if ( empty( $user_id ) ) {
			return false;
		}

		/**
		 * Allows customizing the caps a user must have to be allowed to manage attendees.
		 *
		 * @since 4.6.3
		 *
		 * @param array $default_caps The caps a user must have to be allowed to manage attendees.
		 * @param int $user_id The ID of the user whose capabilities are being checked.
		 */
		$required_caps = apply_filters( 'tribe_tickets_caps_can_manage_attendees', array(
			'edit_others_posts'
		), $user_id );

		// Next make sure the user has proper caps in their role.
		foreach ( $required_caps as $cap ) {
			if ( ! user_can( $user_id, $cap ) ) {
				$user_can = false;
				// break on first fail
				break;
			}
		}

		/**
		 * Filter our return value to let other plugins hook in and alter things
		 *
		 * @since 4.10.1
		 *
		 * @param bool $user_can return value, user can or can't
		 * @param int $user_id id of the user we're checking
		 * @param int $event_id id of the event we're checking (matter for checks on event authorship)
		 */
		$user_can = apply_filters( 'tribe_tickets_user_can_manage_attendees', $user_can, $user_id, $event_id );

		return $user_can;
	}

Top ↑

Changelog

Changelog
Version Description
4.6.3 Introduced.