Make Picture Mandatory on Job board

How do i make uploading a picture mandatory on the Job board?

Thanks!

If you mean to make the required image field for listings then please try this PHP snippet Require uploading at least one image for listings #hivepress #listings · GitHub

I mean require image field for “request a service”

Please try this PHP snippet

add_filter(
	'hivepress/v1/forms/request_submit/errors',
	function( $errors, $form ) {
		$listing = $form->get_model();

		if ( $listing && ! $listing->get_image__id() ) {
			$errors[] = 'Please upload at least one image.';
		}

		return $errors;
	},
	100,
	2
);

add_filter(
	'hivepress/v1/forms/request_submit',
	function( $form ) {
		$form['fields']['images']['statuses']['optional'] = null;

		return $form;
	},
	1000
);

Hi, the snippet isn’t working for some reason

Im assuming the code should be submit_request not request_submit, but i dont code

If you mean posting a request then please make sure that the snippet was correctly added with Code Snippets or another similar plugin. It was tested locally and seems to be ok

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