Restrict making offers to users with listings only

Hello. Is it possible that only people with an active listings can reply to request?

Yes, it works this way by default (vendor profiles are registered only if at least one listing is added), and only vendors can make offers for requests.

Yes, I know, but if the ad expires, they can still make offers. My point is that this option is only available to those who have active(published) ads. Not as draft or pending

Yes, the user remains a vendor even if the listing has expired. This status and profile are assigned if at least one listing is left and is not automatically removed.

That’s why I’m asking if anyone has a code that checks it and blocks the possibility of offering in the event of an inactive ad.

Unfortunately there’s no simple code snippet for this, in the current version the vendor status is not revoked from user if the last listing they have is expired because they can still renew it. Vendor profile can be only removed manually.

I wrote a custom filter myself. Maybe someone will like it someday.

	function( $errors, $form ) {
			$listing_count = \HivePress\Models\Listing::query()->filter(
					'status__in' => 'publish',
					'user'       => get_current_user_id(),

			if ( $listing_count == 0 ) {
				$errors[] = 'Error text';
		return $errors;
1 Like

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