hi,
to enable bookings or registration by default in the frontend event form, you can add this javascript in your theme footer.php right below wp_footer()
eg.
<?php wp_footer(); ?>
<script>
jQuery(document).ready( function($){
$("input[id='event-rsvp']").click();
});
</script>
would it be possible to add a custom function to bp-custom.php in plugin folder?
Yes, you could adapt the code to run in bp-custom.php.
Can you kindly help me with this code? I can’t figure it out. Many thanks in advance and sorry for the trouble!
function my_em_modify_default_ticket($EM_Ticket) {
if ( empty($EM_Ticket->ticket_id) ) {
$EM_Bookings->event_rsvp_box = 'checked';
}
}
add_filter('em_ticket', 'my_em_modify_default_ticket', 10, 2);
I’d recommend using the jQuery code Angelo gave, I think it’ll be the easiest way of doing this.
You need to check that it’s not checked, otherwise user editing an event will see a prompt to remove bookings. Here’s how you put in php (functions.php or your own plugin):
function enable_bookings_by_default_js_footer() {
?>
<script>
jQuery(document).ready( function($){
if (!$('#event-rsvp').is(":checked")) {
$("input[id='event-rsvp']").click();
}
});
</script>
<?php
}
add_action('wp_footer', 'enable_bookings_by_default_js_footer');