Support Forum
Support › MB User Meta › Sort the username and email fieldsResolved
Hello, I am follow the next guide to build a Custom Register Page:
https://metabox.io/create-wordpress-custom-user-profile-page-in-frontend/
I am using the next shortcode
[mb_user_profile_register id="usuarios-campos-personalizados" label_submit="Register" confirmation="Your account has been created successfully!"]
So I get the custom personal register form but the form show the default fielsd (Username, Email, Password, Confirm password) in first place. Please see the image:
https://i.imgur.com/kzqRwTc.png
However I want sort my form in different order, for example:
First name
Last name
Email address
other_custom_field
Username
Password
Confirm password
How can I get it? is possible
Thank you in advanced!
Hi,
You can follow Johannes's reply to customize the registration form https://support.metabox.io/topic/registration-username-as-email-duplicated-fields-avatar-visibility-issue/page/2/#post-21465.
function add_more_registration_fields( $fields ) {
$fields = [
'first_name' => [
'name' => 'First Name',
'id' => 'first_name',
'type' => 'text',
'required' => 1
],
'last_name' => [
'name' => 'Last Name',
'id' => 'last_name',
'type' => 'text',
'required' => 1
],
'username' => [
'name' => __( 'Username', 'mb-user-profile' ),
'id' => 'user_login',
'type' => 'text',
'required' => true,
],
'email' => [
'name' => __( 'Email', 'mb-user-profile' ),
'id' => 'user_email',
'type' => 'email',
'required' => true,
],
'password' => [
'name' => __( 'Password', 'mb-user-profile' ),
'id' => 'user_pass',
'type' => 'password',
'required' => true,
'desc' => '<span id="password-strength" class="rwmb-password-strength"></span>',
],
'password2' => [
'name' => __( 'Confirm Password', 'mb-user-profile' ),
'id' => 'user_pass2',
'type' => 'password',
'required' => true,
],
// ... add more fields here
];
return $fields;
}
add_filter( 'rwmb_profile_register_fields', 'add_more_registration_fields' );
Get more form filters here https://docs.metabox.io/extensions/mb-user-profile/#form-fields-filters. They are located in the file wp-content/plugins/mb-user-profile/src/DefaultFields.php
.
Sorry but I don't understand. I added it code in my functions.php and i didn't get nothing. What should I do?
Hi,
Please check the file functions.php in the activated theme. Or you can use the plugin Code Snippets to run the code https://wordpress.org/plugins/code-snippets/.
Hello, I did it but it doesn't work correctly:
Ahn said "and will do for User Profile next." I had hoping that User profile will work equal to "Frontend Submission extension"
Do you think that in sometime Anh retake this extension?
Hi,
Did you require/include the file "custom-functions/functiones.php" in the main file functions.php of the "astra-child" theme?
You can add the code to the file functions.php, screenshot https://share.getcloudapp.com/5zuA6xGb
or just use the plugin Code Snippets to see it works.
295 / 5000
Resultados de traducción
Hello, I really appreciate your answer. But you haven't really answered any of my questions.
I want to think that it is because my English is very bad and at some point you have not understood me.
I am using the file "functions.php" because in the file "functions.php" I wrote the following lines:
require_once('custom-functions/funciones.php');
You can see it:
https://imgur.com/3Wo1xwf
Now you can see that my code is working and none of my questions were aimed at telling you that the Hook you provided was not working. On the contrary, this works but I asked you 3 specific questions. I did not receive any response. Can you solve them please? If because of my poor English you don't understand something, why don't you tell me and I'll try to explain it better
Hi,
Sorry if I misunderstood your questions. I will try to reply sequently.
id="meta-box-id"
to the shortcode to create different forms.
function add_more_registration_fields( $fields ) {
$fields = [
[
'name' => __( 'Email', 'mb-user-profile' ),
'id' => 'user_email',
'type' => 'email',
'required' => true,
],
[
'name' => __( 'Password123', 'mb-user-profile' ),
'id' => 'user_pass',
'type' => 'password',
'required' => true,
'desc' => '<span id="password-strength" class="rwmb-password-strength"></span>',
],
[
'name' => __( 'Confirm Password123', 'mb-user-profile' ),
'id' => 'user_pass2',
'type' => 'password',
'required' => true,
],
// ... add more fields here
];
return $fields;
}
Hello now it is more clear. A thank you very much. Maybe can you tell me if developer team is planning retake this matter?
Hello any news about this?
Hi Luis,
Sorry for the late reply.
With the custom code above, I think you can re-order the custom fields of the user profile/register form, as well as the frontend submit form.
https://metabox.io/frontend-submission-reorder-post-fields/