Post a Request and List a service button

I will like to hide the Post a Request button if the user logged in as an expert and the same for List a Service, if the user logged in, is a customer/buyer. Both buttons show when logged in and it kind of confuses users also when this happens they get dashboards with earnings info

Please try this PHP snippet

add_filter( 
	'hivepress/v1/templates/site_header_block/blocks',
	function( $blocks, $template ) {
		if(is_user_logged_in() && !current_user_can('edit_posts')){
			$blocks = hivepress()->helper->merge_trees(
					[ 'blocks' => $blocks ],
					[
						'blocks' => [
							'listing_submit_link' => [
								'type' => 'content',
							],
						],
				]
				)['blocks'];
		}
		
		if(hivepress()->get_version( 'requests' ) && is_user_logged_in() && current_user_can('edit_posts')){
			$blocks = hivepress()->helper->merge_trees(
					[ 'blocks' => $blocks ],
					[
						'blocks' => [
							'request_submit_link' => [
								'type' => 'content',
							],
						],
				]
				)['blocks'];
		}
		
		return $blocks;
	},
    1000,
	2
);

Thank you for much. This did the trick. Much appreciate it.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.