Hi, I want only certain member categories to see the create list button. How can I achieve it?
If you mean vendor categories then please try this PHP snippet. Please change 1,2,3
on vendor categories where you want to show this button
add_filter(
'hivepress/v1/templates/site_header_block',
function ($template){
$vendor = \HivePress\Models\Vendor::query()->filter(
[
'user' => get_current_user_id(),
'status' => 'publish',
]
)->get_first();
if(!$vendor || !array_intersect([1,2,3], $vendor->get_categories__id())){
$template = hivepress()->helper->merge_trees(
$template,
[
'blocks' => [
'listing_submit_link' => [
'type' => 'content',
],
],
]
);
}
return $template;
},
1000
);
But please note that hiding the button will make it harder for the user to become a vendor. Please look for additional ways for users to become a vendor as described in this tutorial How to add a vendor registration form - HivePress Help Center
1 Like
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.