Change User Block Position, Remove Delete Account & Quantity Limitations

Hi,

Would it be possible to provide a snippet to move the User Block first on the Request single page like the one that exist to change the position of the Vendor Block on the Listing single page please? I’ve tried to modify it to make it work but I can’t figure it out…

Also, I would like to remove the “Delete Account” button at the bottom of the User settings form but I can’t find a way to do it… is there an available snippet for that too?

And last thing, I’ve integrated the snippets to limit the number of images we can add to a Request or a Listing as well as to limit the number of Tags possible in a Listing but they are not working. Is there something specific to do other than activate the snippets to make them work?

Thank you
Philippe

  1. Please clarify where you want to put the user block on the request page?

  2. Please try this PHP snippet

add_filter( 
	'hivepress/v1/templates/user_edit_settings_page', 
	function( $template ) {
		return hivepress()->helper->merge_trees(
			$template,
			[
				'blocks' => [
					'user_update_form' => [
						'footer' => [
							'form_actions' => [
								'blocks' => [
									'user_delete_link' => [
										'type' => 'content',
									],
								],
							],
						],
					],
				],
			]
		);
	
		return $blocks;
	},
	1000
);
  1. If you mean to set the maximum number of tags for listings then please check this topic Set a minimum and a maximum for tags - #2 by yevhen

Regarding #1, here’s what I would like to do.
I believe it should be similar to this snippet : Change the vendor position (order) on the single listing page #hivepress #listings · GitHub

For #2, it worked, thank you!

For #3, it still doesn’t work like the following 2 that I’ve tried.

  1. Please try this PHP snippet
add_filter(
	'hivepress/v1/templates/request_view_page',
	function( $template ) {
		return hivepress()->helper->merge_trees(
			$template,
			[
				'blocks' => [
					'request_user' => [
						'_order' => 5,
					],
				],
			]
		);
	},
	1000
);
  1. If you mean to restrict the maximum number of tags per listing then please try this PHP snippet
add_filter( 
	'hivepress/v1/models/listing/attributes', 
	function ($attributes){
		if(isset($attributes['tags'])){
			$attributes['tags']['edit_field']['max_values'] = 3;
		}
		
		return $attributes;
	},
	1000
);

The snippet to limit the amount of Tags still doesn’t work for me, but it’s fine.
However, the other ones worked perfectly, thanks a lot for your support!

Please make sure that you have correctly put the code snippet for tags. It was tested locally and seems to be ok. If the vendor adds more than 3 tags for a listing then the vendor sees the error as on the screenshot