• Hello,

    I need to create a button to cancel a booking.

    <a href="' . get_site_url() . '?action=booking_cancel&booking_id=' . esc_html( $row->booking_id) . '&_wpnonce=">Annuler</a>';

    but… how can I know the _wpnonce value ?

    Without the _wpnonce field, the server returns “Tente d’effectuer une action illégal”

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

    (@angelo_nwl)

    Thread Starter alexandraka

    (@alexandraka)

    This solution seems not to work ; same effect.
    here is my code ;

    $my_nonce = wp_create_nonce('delete_my_rec');
    $display_annuler = '<a href="' . get_site_url() . '?action=booking_cancel&booking_id=' . esc_html( $row->booking_id) . '&_wpnonce=' . $my_nonce .  '">Annuler</a>';

    The goal is to create a interface for user to cancel his booking, but I wish to reuse the Events Manager plugin cancelation functions.

    That’s why (I believe) the nonce ‘delete_my_rec’ is incorrect, I think I should replace by the nonce expected in the cancelation booking function, isn’t it ?

    Thread Starter alexandraka

    (@alexandraka)

    for instance, in em-actions.php (line 137)

    }elseif( $_REQUEST['action'] == 'event_detach' && wp_verify_nonce($_REQUEST['_wpnonce'],'event_detach_'.get_current_user_id().'_'.$EM_Event->event_id) ){
    The nonce is ; event_detach_<current_user_id>_<event_id>

    so, If a user wants to cancel his booking, he shall click on
    …/?action=booking_cancel&booking_id=24&_wpnonce=616bca5939

    what is the name of the nonce in this case ?

    Plugin Support angelo_nwl

    (@angelo_nwl)

    did you already tried to check the template file at events-manager/templates/templates/my-bookings.php which contains cancel bookings.

    Thread Starter alexandraka

    (@alexandraka)

    hello,
    finaly, I found the nonce code by digging in the plugin code.
    The wp_nonce I was looking for was “booking_cancel”

    thx for your support

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘wp_nonce’ is closed to new replies.