Tour Master – Custom Fields in Register form

The developer documentation assumes you have knowledge and coding skills. While we created these docs to help you achieve things not available in the original features, we do not provide support if something doesn’t work when referencing the developer documentation. If the example code doesn’t work for you, please debug it yourself or hire a freelancer to help with debugging.

All customizations will be lost when you update our theme/plugin to a new version in the future. To avoid this, you must use filters and actions: https://developer.wordpress.org/plugins/hooks/.

– To add the customize field in the register form, please take a look at this file: \wp-content\plugins\tourmaster\include\user-util.php around line 660. You will see the default code like this:

	if( !function_exists('tourmaster_get_profile_fields') ){
		function tourmaster_get_profile_fields(){
			return apply_filters('tourmaster_profile_fields', array(
				'first_name' => array(
					'title' => esc_html__('First Name', 'tourmaster'),
					'type' => 'text',
					'required' => true
				),
				'last_name' => array(
					'title' => esc_html__('Last Name', 'tourmaster'),
					'type' => 'text',
					'required' => true
				),
				'gender' => array(
					'title' => esc_html__('Gender', 'tourmaster'),
					'type' => 'combobox',
					'options' => array(
						'' => '-',
						'male' => esc_html__('Male', 'tourmaster'),
						'female' => esc_html__('Female', 'tourmaster')
					)
				),
				'birth_date' => array(
					'title' => esc_html__('Birth Date', 'tourmaster'),
					'type' => 'date',
					'required' => true
				),
				'email' => array(
					'title' => esc_html__('Email', 'tourmaster'),
					'type' => 'email',
					'required' => true
				),
				'phone' => array(
					'title' => esc_html__('Phone', 'tourmaster'),
					'type' => 'text',
					'required' => true
				),
				'country' => array(
					'title' => esc_html__('Country', 'tourmaster'),
					'type' => 'combobox',
					'options' => tourmaster_get_country_list(),
					'required' => true,
					'default' => tourmaster_get_option('general', 'user-default-country', '')
				),
				'contact_address' => array(
					'title' => esc_html__('Contact Address', 'tourmaster'),
					'type' => 'textarea'
				),
			));
		}
	}	

You can add a new custom field like this after the contact_address field.

				'contact_address' => array(
					'title' => esc_html__('Contact Address', 'tourmaster'),
					'type' => 'textarea'
				),
				'your_custom_field' => array(
					'title' => esc_html__('New field', 'tourmaster'),
					'type' => 'textarea'
				),

You can change the custom field type to: combobox, text, date, and textarea. You can try to check the register form now.