Make user registration fields (first last name and photo) required

Hi there! I saw the thread for making vendor name and photo fields required (thank you), but I need to also a regular user (subscriber) have the same required fields. Is this possible? Thanks in advance!

Good day! Yes, use these two code snippets below.

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

		if ( $user && ! $user->get_image__id() ) {
			$errors[] = 'Please upload the profile image.';
		}

		return $errors;
	},
	100,
	2
);

add_filter(
	'hivepress/v1/forms/user_update',
	function( $form ) {
		$form['fields']['first_name']['required'] = true;
		$form['fields']['last_name']['required'] = true;
		$form['fields']['image']['statuses']['optional'] = null;

		return $form;
	},
	1000
);
1 Like

That worked beautifully, thank you kindly! :slight_smile:

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