php Event Tickets Plus:禁止与会者修改其与会者信息,他们的RSVP“Going / Not Going”状态和/或他们的“Do”的能力
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php Event Tickets Plus:禁止与会者修改其与会者信息,他们的RSVP“Going / Not Going”状态和/或他们的“Do”的能力相关的知识,希望对你有一定的参考价值。
<?php
/**
* Event Tickets Plus: Disable attendees' ability to modify their attendee information, their RSVP
* "Going / Not Going" status, and/or their "Don't list me on the public attendee list" response
* at yoursite/event/your-single-event/tickets/
*
* @link https://gist.github.com/cliffordp/5bf5a283b2b3ffaf64c119d86613ced0 This snippet.
*/
add_action( 'tribe_tickets_pre_get_template_part', 'cliff_etplus_disable_attendee_able_to_edit_meta', 10, 3 );
function cliff_etplus_disable_attendee_able_to_edit_meta( $slug, $name, $data ) {
// TODO: !!! CUSTOMIZE THIS !!! Change to an empty array or fully delete it to disable meta editing for all events.
$event_ids_w_disabled_meta_editing = [
154,
];
if ( 'tickets-plus/orders-edit-meta' !== $slug ) {
return;
}
if (
! empty( $event_ids_w_disabled_meta_editing )
&& (
empty( $data['attendee']['event_id'] )
|| ! in_array( absint( $data['attendee']['event_id'] ), $event_ids_w_disabled_meta_editing )
)
) {
return;
}
// TODO: !!! Read these comments because you may want to alter the behavior !!!
?>
<script>
jQuery( document ).ready( function () {
// Disallow changes to existing attendee meta information
jQuery( 'form .ticket-meta' ).prop( 'disabled', true );
// Disallow changes to RSVP "Going / Not Going"
jQuery( 'form select' ).prop( 'disabled', true );
// Disallow changes to "Don't list me on the public attendee list" checkbox
jQuery( 'form input' ).prop( 'disabled', true );
// Remove the submit button
// !!! Do not do this if you modify the code above to enable modifying some but not all data !!!
jQuery( 'form .tribe-submit-tickets-form' ).remove();
} );
</script>
<?php
}
以上是关于php Event Tickets Plus:禁止与会者修改其与会者信息,他们的RSVP“Going / Not Going”状态和/或他们的“Do”的能力的主要内容,如果未能解决你的问题,请参考以下文章