1

I'm using Hook from wcfm to disable the status update option but it's not working. I want to restrict the vendors from updating status.

add_action( 'wcfm_booking_overview_block', 'disable_cancelled_booking', 20, 2 ); 
function disable_cancelled_booking($booking, $product) { 
global $current_user; //Get User Role 
$user_roles = $current_user->roles; 
$user_role = array_shift($user_roles);

//Checking Status of booking & role of the current user based on that the status update field will be hidden 
if(($booking->status == "cancelled" || $booking->status == "unpaid"|| $booking->status == "pending-confirmation") && $user_role =="wcfm_vendor") { 
//Disable option
 } } 
  • Are you sure your hook is called? Have you logged out something in the hook to verify this? – Mr. Jo Jun 24 '21 at 11:50
  • The above hook is of booking page from here I will get the current booking object. I just want the status update option to be hidden or disabled – Shaikh Aejaz Ahmed Jun 24 '21 at 11:53
  • Have you ever thought a minute about my comment? Sometimes hooks are not called. I asked you if you verified if your hook gets called by logging out something. – Mr. Jo Jun 24 '21 at 11:58
  • 1
    yes it's getting called. I've printed $booking object within hook & it's working. print_r($booking); – Shaikh Aejaz Ahmed Jun 24 '21 at 12:01
  • 1
    add_filter( 'wcfm_is_allow_booking_status_update', false ); this inside if statement resolves the issue. Thanks – Shaikh Aejaz Ahmed Jun 24 '21 at 12:05

1 Answers1

2

There is a filter from wcfm 'wcfm_is_allow_booking_status_update'which does the trick