[Events+] Modify registering behaviour

Is there a way to keep the payment form visible rather than after clicking the IM ATTENDING button?

  • Predrag Dubajic
    • Support

    Hi Rebecca,

    Apologies for the delay here, we’ve been short staffed for last couple of days and we’re doing our best to bring everything back to normal now, this also caused developer delay so we don’t have any update yet but hopefully we will be able to give you more info soon.

    Best regards,

    Predrag

  • Panos
    • SLS

    Hi there Rebecca !

    There is no option for this so I tried checking if there is any way to override default functionality with code. However there is no easy way for this. It could be possible by doing some changes in files however this is out of support scope. We could try the following workaround though. When an event page loads, it can automatically set the user to be attending to this even. This way the payment form should show up. If you agree to that you can try out the following snippet :

    add_action( 'wp_head', function(){

    if ( ! is_singular( 'incsub_event' ) ) {
    return;
    }

    ?>
    <style type="text/css">
    #wpmudevevents-header .wpmudevevents-buttons {
    display: none;
    }
    </style>
    <?php

    } );

    add_action( 'template_redirect', function() {

    if ( ! is_user_logged_in() || ! is_singular( 'incsub_event' ) ) {
    return;
    }

    global $wpdb;

    $event_id = get_queried_object_id();
    $user_id = get_current_user_id();
    $table_name = Eab_EventsHub::tablename( Eab_EventsHub::BOOKING_TABLE );
    $user_status = $wpdb->get_var(
    $wpdb->prepare(
    "SELECT status FROM {$table_name} WHERE event_id = %d AND user_id = %d;",
    $event_id,
    $user_id
    )
    );

    if ( Eab_EventModel::BOOKING_YES == $user_status ) {
    return;
    }

    //$EAB_Hub = new Eab_EventsHub();
    //$EAB_Hub->update_rsvp_per_event( $event_id, $user_id, 'yes' );

    $wpdb->query(
    $wpdb->prepare(
    "INSERT INTO {$table_name} VALUES( null, %d, %d, NOW(), %s ) ON DUPLICATE KEY UPDATE <code>status</code> = %s",
    $event_id,
    $user_id,
    Eab_EventModel::BOOKING_YES,
    Eab_EventModel::BOOKING_YES
    )
    );

    do_action( 'incsub_event_booking', $event_id, $user_id, 'yes' );
    do_action( 'incsub_event_booking_yes', $event_id, $user_id );

    } );

    The above should also hide the attending buttons. You can copy paste that snippet in a mu-plugin and do some tests. If you are not familiar with mu-plugins, you can read about them here :

    https://premium.wpmudev.org/manuals/wpmu-manual-2/using-mu-plugins/

    Alternatively you can paste that snippet in your child theme’s functions.php file, but make sure you are using a child theme so it doesn’t get overridden with theme updates.

    Hope this helps!

    Kind regards!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.