how to add custom registration field on registration form?

Posted in: Newspaper
Post count: 8

how to add custom registration field on registration form?

for example: i want to add user phone number on registration form & update it in user_meta

Post count: 22421

Hello,
Unfortunately, our theme has no such option. You can follow this guide to see how it can be done from wp:
http://www.wpbeginner.com/plugins/how-to-add-additional-user-profile-fields-in-wordpress-registration/
Thanks.

Post count: 8

i know that your theme got no such option…
so i ask you how to add some code to do that…

here is default code for registering user with custom form field:

add_action(‘user_register’,’custom_user_register’);
function custom_user_register($user_id) {
if (!empty($_POST[‘bank’])) {
update_user_meta($user_id,’bank’,trim($_POST[‘bank’]));
}
if (!empty($_POST[‘account_no’])) {
update_user_meta($user_id,’account_no’,trim($_POST[‘account_no’]));
}
if (!empty($_POST[‘account_holder_name’])) {
update_user_meta($user_id,’account_holder_name’,trim($_POST[‘account_holder_name’]));
}
if (!empty($_POST[‘phone’])) {
update_user_meta($user_id,’phone’,trim($_POST[‘phone’]));
}
}

where should i put those code?
those code doesn’t work with your theme

i can add some extra field on your registration form by adding some code in the file top-menu.php in directory /parts/header/ but it wont save those custom field to usermeta

Post count: 22421

Hello,
Unfortunately that is why I suggested a plugin because the theme login is custom and the code you suggested cannot tie into ours. You will need custom implementation that falls beyond what support can provide you. You can hire a freelancer to help you out in this task from sites like studio.envato.com.
Thank you!

Post count: 8

what a FUCKING answer!!!
you even don’t know how to modified your own creation theme, now you told me to hire a freelancer…!!!

Post count: 9544

You need to learn how to customize WordPress — theme support doesn’t include custom programming, only support for the built-in features of the theme.

You might try looking at the help on wordpress.org on how to create a new function for user_meta, to put in your functions.php file, which might then save that to the dbase.
https://codex.wordpress.org/Function_Reference/add_user_meta

Or, you might use something like ACF – advanced custom fields — maybe that will help.

Or, if you don’t know how to edit your functions.php to add new elements for working with WordPress data fields — hire a programmer.

(( I don’t work here — but have been using the theme for 2.5 years ))

  • This reply was modified 10 years by simchris.
Viewing 6 posts - 1 through 6 (of 6 total)
The forum ‘Newspaper’ is closed to new topics and replies.