Support » Plugin: Events Manager » Enable registration by default

  • Resolved psmorrow

    (@psmorrow)


    Hi, is it possible to enable registration by default using a custom function? I have changed the default values for ticket fields but I don’t know how to do this for the “enable registration for this event” selection box.

    Any help you can provide is greatly appreciated!

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support angelo_nwl

    (@angelo_nwl)

    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>
    
    Thread Starter psmorrow

    (@psmorrow)

    would it be possible to add a custom function to bp-custom.php in plugin folder?

    Plugin Support caimin_nwl

    (@caimin_nwl)

    Yes, you could adapt the code to run in bp-custom.php.

    Thread Starter psmorrow

    (@psmorrow)

    Can you kindly help me with this code? I can’t figure it out. Many thanks in advance and sorry for the trouble!

    Plugin Support caimin_nwl

    (@caimin_nwl)

    What code did you try?

    Thread Starter psmorrow

    (@psmorrow)

    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);
    Plugin Support caimin_nwl

    (@caimin_nwl)

    I’d recommend using the jQuery code Angelo gave, I think it’ll be the easiest way of doing this.

    arbolife

    (@arbolife)

    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');
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Enable registration by default’ is closed to new replies.