Add custom fields to the user registration form

listingHive has a registration form that does not allow you to enter other data such as address, telephone number, etc., but only email and name. Is it possible to edit it and add other items?

thanks for the answer

Unfortunately there’s no such option yet, because regular users don’t have custom profile fields, only vendors do (those users with at least 1 listing). We plan to add this feature, some fields are already possible to add via the code snippets Add first and last name fields to the user registration form #hivepress #users · GitHub

1 Like

Ok
is it not even possible to insert the confirm password field in the registration form?

There’s no simple code snippet for this, but I don’t recommend adding this field, it’s considered a bad UX practice and most popular platforms are also removing this field Why the Confirm Password Field Must Die | by UX Movement | Medium

Hello Ihor,

According to the referenced article, removing the password confirmation should be accompanied with an option to ‘unmask’ the password (i.e. a show password toggle). Do you expect to add this function?

1 Like

Yes, we plan to add this along with the password strength indicator.

Hi, I found a way to create a new field on user registration form.

Just follow this 2 steps:

  1. Create a new attribute on users (telefone, in my case).
  2. Paste this following code on functions.php:
add_filter(
	'hivepress/v1/forms/user_register',
	function ( $form ) {
		$form['fields'] = array_merge(
			$form['fields'],
			[
				'hp_telefone'  => [
					'type' => 'phone',				
					'required' => true,
					'_order'   => 3,
					'label' => 'Telefone',
					'value' => '+55',
				],
				
			]
		);

		return $form;
	},
	100
);

add_action(
	'hivepress/v1/models/user/register',
	function( $user_id, $values ) {
		if ( isset( $values['hp_telefone'] ) ) {
			update_user_meta( $user_id, 'hp_telefone', $values['hp_telefone'] );
		}
	},
	10,
	2
);

Working example:

7 Likes

Can you show an example ? Because i add a new attribute on user (no vendors), i add hp_society, and i paste the code with change, but nothing work…

Thank u for u herlp !