Support Forum
Support › MB User Profile › Hello how can i make my custom field appear on user registrationResolved
Hello,
After creating custom fields.
Where can i put this php so i can get it to appear on my registration form ?
https://boost.my.id/wp-login.php?action=register
I tried to add it using code snippet plugin but none seems to appear on registration form
Thank you
Joie
<?php
add_filter( 'rwmb_meta_boxes', 'ficid_add_kontak' );
function ficid_add_kontak( $meta_boxes ) {
$prefix = '';
$meta_boxes[] = [
'title' => __( 'Kontak', 'ficid' ),
'id' => 'kontak',
'type' => 'user',
'fields' => [
[
'name' => __( 'WhatsApp', 'ficid' ),
'id' => $prefix . 'whatsapp',
'type' => 'tel',
'desc' => __( 'Masukkan angka saja, Masukan 87876565 jika nomor HP anda 087876565', 'ficid' ),
'placeholder' => 87654321,
'required' => true,
'prepend' => 62,
'admin_columns' => [
'position' => 'after title',
'title' => 'Whatsapp',
],
],
[
'type' => 'heading',
'name' => __( 'Alamat', 'ficid' ),
],
[
'name' => __( 'Jalan / Unit', 'ficid' ),
'id' => $prefix . 'alamat_jalan_unit',
'type' => 'text',
],
[
'name' => __( 'Provinsi', 'ficid' ),
'id' => $prefix . 'alamat_provinsi',
'type' => 'autocomplete',
'options' => [
'jakarta' => __( 'Jakarta', 'ficid' ),
'jawa-timur' => __( 'Jawa Timur', 'ficid' ),
'papua' => __( 'Papua', 'ficid' ),
'sumatera-utara' => __( 'Sumatera Utara', 'ficid' ),
],
],
[
'name' => __( 'Kota / Kabupaten', 'ficid' ),
'id' => $prefix . 'alamat_kota_kabupaten',
'type' => 'autocomplete',
'options' => [
'kota-jakarta-barat' => __( 'Kota Jakarta Barat', 'ficid' ),
'kota-jakarta-pusat' => __( 'Kota Jakarta Pusat', 'ficid' ),
'kota-mojokerto' => __( 'Kota Mojokerto', 'ficid' ),
'kab-mojokerto' => __( 'Kab Mojokerto', 'ficid' ),
],
],
],
];
return $meta_boxes;
}
Hi,
You can add the registration shortcode to a regular page to display the registration form and custom fields instead of the default registration form of WordPress
[mb_user_profile_register id="kontak"]
Refer to this documentation https://docs.metabox.io/extensions/mb-user-profile/
Hello Thank you for your help.
I added the shortcode,
But my field is not styled correctly
Url is : https://boost.my.id
Could you please help so that :
1. The text 62 is not wrapped
2. The text below the whatsapp field is smaller
Thank you
Joie
Hi,
1. Please use this custom CSS code in Appearance > Customize > Additional CSS, to fix the issue with the prepend text. I will inform the development team to fix this issue in the next update.
span.rwmb-input-group-text {
width: 10%;
justify-content: center;
}
2. The font size of the description text below the WhatsApp field is controlled by your theme style. You can try to contact theme support to ask to change the font size of this text.
What if i want the custom field phone to display in the default WordPress registration form at wp-login, Is that possible ?
Do i need to add php snippet for that
I mean without using a new registration page
Thank you
Joie
Hello please ignore the above request to use wp-login.
I think i will use [mb_user_profile_register] shortcode.
Another question below,
I have custom user field group "user_kontak" consists of theses fields:
custom "user_kontak_whatsapp",
default "user_email",
custom "user_kontak_street"
I tried : [mb_user_profile_register id="user_kontak"]
here what displayed, the email is displayed twice.
https://cln.sh/38xaA0
out of that "user_kontak" field group I just want to use only user_kontak_whatsapp in addtion to the defaul user field registration form
So ideally my registration form will look like :
Email
Password
Confirm password
Whatsapp
Do i need to create a separate field group just to contain the one same field id "user_kontak_whatsapp" ?
Thank you
Joie
Hi,
That is the default fields of the registration form, you can create other fields to add to the registration form, no need to add them twice.
If you want to customize the default fields, please use the filter hook rwmb_profile_register_fields
. Refer to this topic https://support.metabox.io/topic/mb_user_profile_register-autocompletenew-password/#post-27210
To fix styling for MB Labels use this in your style.css
.rwmb-label {
display: contents;
}