Can you edit the attributes from account/listings?

I want to edit the attributes from this account/listings page, I don’t want the hosts to change the location or the title anymore, only the admins should be allowed, is this possible ?

Also, can the host of the property change the price on a specific date? If so, how can you do it ?

  1. Please clarify if you mean blocking these fields completely or moderating any changes? In the current version you can mark an attribute as Moderated and any changes will re-send the listing to moderation.

  2. Yes, if you also installed Marketplace then you can enable variable pricing in HivePress/Settings/Bookings, then vendors can set custom prices for specific date ranges.

I want them to be completely blocked.

Also, my snippet code doesn’t work, I installed the code snippets plugin and activated it, then I went on Appearance > Customize > Additional CSS and I typed in the CSS snippets, none of them works

  1. Please try this PHP snippet to hide title and location fields. Also, it is possible to hide other fields in this way
add_filter(
	'hivepress/v1/models/listing/fields',
	function( $fields, $listing ) {
		foreach ( $fields as $name => $field ) {
			if(in_array($name, ['title', 'location'])){
				$fields[$name]['required'] = false;
			}
		}

		return $fields;
	},
	1000,
	2
);

add_filter(
	'hivepress/v1/forms/listing_update',
	function( $form ) {
		unset($form['fields']['title'], $form['fields']['location']);

		return $form;
	},
	1000
);
  1. Please use the Code Snippets plugin to add and manage custom PHP code snippets Code Snippets – WordPress plugin | WordPress.org as there is a PHP code on your screenshot
  1. If a client wants to list a property, he needs to field the title and the location, so the fields are required when he lists a property. Whenever he wants to edit something to the listing in the edit section (account/listings/) he is not allowed to change the title and the location anymore. The PHP snippet that you gave me is removing the fields completly on list a property page, I want the location and the title only to be removed or blocked in the edit listing section (account/listings/), so that he won’t be allowed to change the title and the location. (Why would he change the location from his property ? Did he moved the house or something ? :joy: )
    Thank you very much for helping me!

Please try this snippet instead, I haven’t tested it locally but it should block the Title and Location fields and make them read-only:

add_filter(
	'hivepress/v1/forms/listing_update',
	function( $form ) {
		$form['fields']['title']['readonly']=true;
		$form['fields']['location']['readonly']=true;

		return $form;
	},
	1000
);

add_filter(
	'hivepress/v1/forms/listing_submit',
	function( $form ) {
		$form['fields']['title']['readonly']=false;
		$form['fields']['location']['readonly']=false;

		return $form;
	},
	1000
);
1 Like