Profile pic mandatory snippet only removes the optional label

I am using the following snippet to make profile pic mandatory for submitting listings.
all it does is just remove the (optional) label from profile image section.
however still allows to submit the listing which i dont want.
is there a way to make the profile image mandatory in order to submit the listing??
thank you.

add_filter(
	'hivepress/v1/forms/user_update',
	function( $form ) {
		if ( isset( $form['fields']['image'] ) ) {
			$form['fields']['image']['statuses'] = ['optional' => null];
		}

		return $form;
	},
	1000
);

Please, try this сode snippet

1 Like

Hi Yana,
Thank you for this code snippet. But when I try to use it this happens.

  1. First I click on list of service button.
  2. Then it takes me to complete profile page
  3. Then I fill up the all the details except upload the profile image.
  4. Then I save.
  5. Then it gives me a message Please upload the profile image.
  6. But instead of uploading the profile image. I click on list a service button again.
  7. And now it takes me to add listing page and I can submit the listing without uploading profile image.

Is this a bug?? I don’t know what’s happening??

I found out about it because I have a vendor who hadn’t uploaded a profile image.
but had filled up other details. I asked him to try to list a service to see if the code snippet works. But it didn’t work. Instead of going to complete profile page. It went directly to add listing page.

Please help,
Thank you

Please send temporary WP access via email to support@hivepress.io and I’ll check this issue. You can create a temporary access link using this plugin Temporary Login Without Password – WordPress plugin | WordPress.org

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