wervelweb

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • in reply to: Only specific user role can order tickets? #950558
    wervelweb
    Participant

    Hi Brian

    I already used current_user_can for showing different buttons for each role.
    That works perfect but when non members entered wrong login credentials.. (we have a login below the button!!)
    the form action still processes “wootickets_process’, 1” and the ticket got added to cart.

    But you made me thinking!…
    I used current_user_can script in form action and that fixed the problem.

    Thanx

    <form action=”<?php
    if( current_user_can( ‘administrator’ ) ){ echo esc_url( add_query_arg( ‘wootickets_process’, 1, $woocommerce->cart->get_cart_url() ) );}
    //——————————————–//
    elseif( current_user_can( ‘customer’ ) ){ echo ”;}
    //——————————————–//
    elseif( current_user_can( ‘MEMBER’ ) ){ echo esc_url( add_query_arg( ‘wootickets_process’, 1, $woocommerce->cart->get_cart_url() ) );}
    //——————————————–//
    else{ echo ”;}
    //——————————————–//
    ?>”
    class=”cart” method=”post” enctype=’multipart/form-data’>

Viewing 1 post (of 1 total)