php 事件故障单 - 从wp-admin表中删除签入的参加者

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 事件故障单 - 从wp-admin表中删除签入的参加者相关的知识,希望对你有一定的参考价值。

<?php
/**
 * Event Tickets - Remove Checked-In Attendees from wp-admin table
 *
 * Can help the Attendees List table screen's performance after some of the attendees have been checked in.
 * Modified from Barry's original version on May 24, 2017, to support all ticket types.
 * Ideas: only do this if a specific query parameter exists, or only do this if a button is clicked (but then the point about this being a performance improvement would no longer be valid)
 *
 * @param $query
 * 
 * @link https://gist.github.com/cliffordp/d1643e84bb41dda0a5c86100ae52b07f
 */
function attendee_screen_filter_out_checked_in_attendees( $query ) {
	$attendee_post_types = array(
		'tribe_rsvp_attendees',
		'tribe_wooticket',
		'tribe_eddticket',
		'tribe_wpecticket',
		'tribe_shoppticket',
	);

	if ( ! in_array( $query->get( 'post_type' ), $attendee_post_types ) ) {
		return;
	}

	// Reform meta query - filter out those already checked in
	$meta_query = array(
		array(
			'key'   => $query->get( 'meta_key' ),
			'value' => $query->get( 'meta_value' ),
		),
		// RSVP
		array(
			'key'     => '_tribe_rsvp_checkedin',
			'compare' => 'NOT EXISTS',
		),
		// WooCommerce
		array(
			'key'     => '_tribe_wooticket_checkedin',
			'compare' => 'NOT EXISTS',
		),
		// EDD
		array(
			'key'     => '_tribe_eddticket_checkedin',
			'compare' => 'NOT EXISTS',
		),
		// WPEC
		array(
			'key'     => '_tribe_wpecticket_checkedin',
			'compare' => 'NOT EXISTS',
		),
		// Shopp
		array(
			'key'     => '_tribe_shoppticket_checkedin',
			'compare' => 'NOT EXISTS',
		),
	);

	// Clear out previous meta query
	$query->set( 'meta_key', '' );
	$query->set( 'meta_value', '' );

	// Update
	$query->set( 'meta_query', $meta_query );
}

function attendee_screen_remove_checked_in_attendees_setup() {
	add_action( 'pre_get_posts', 'attendee_screen_filter_out_checked_in_attendees', 200 );
}

function attendee_screen_remove_checked_in_attendees_teardown( $passthru ) {
	remove_action( 'pre_get_posts', 'attendee_screen_filter_out_checked_in_attendees', 200 );

	return $passthru;
}

add_action( 'tribe_tickets_attendees_page_inside', 'attendee_screen_remove_checked_in_attendees_setup' );
add_filter( 'tribe_tickets_event_attendees', 'attendee_screen_remove_checked_in_attendees_teardown' );

以上是关于php 事件故障单 - 从wp-admin表中删除签入的参加者的主要内容,如果未能解决你的问题,请参考以下文章

php 事件日历:从wp-admin事件编辑屏幕中删除管理器的一种方法。可能会产生其他意想不到的后果;需要测试

php 事件日历:从wp-admin事件编辑屏幕中删除管理器的一种方法。可能会产生其他意想不到的后果;需要测试

php 检查是否在wp-admin事件编辑屏幕上

安装wordpress,到wp-admin/install.php步,出现500错误,怎么办

php 事件日历:所有Venue slugs都以自定义字符串为前缀。适用于wp-admin和社区活动。

左连接不返回所有结果