Hi, can someone please share the snippet to hide the Make an offer button if the request belongs to the authenticated user? I have tried multiple methods with no success.
If anyone can point me in the right direction, that also works.
Thanks!!
Hi, can someone please share the snippet to hide the Make an offer button if the request belongs to the authenticated user? I have tried multiple methods with no success.
If anyone can point me in the right direction, that also works.
Thanks!!
You can try the following (works for me):
add_filter(
'hivepress/v1/templates/request_view_page/blocks',
function ($blocks, $template){
$request = $template->get_context('request');
if(!$request ){
return $blocks;
}
if(get_current_user_id() !== $request->get_user__id()){
return $blocks;
}
return hivepress()->helper->merge_trees(
[ 'blocks' => $blocks ],
[
'blocks' => [
'offer_make_link' => [
'type' => 'content',
],
],
]
)['blocks'];
},
1000,
2
);