Skip to:
Content

BuddyPress.org

Opened 11 years ago

Last modified 4 months ago

#5373 new enhancement

Removing requirement of Name profile field during registration

Reported by: modemlooper's profile modemlooper Owned by:
Milestone: Awaiting Contributions Priority: normal
Severity: normal Version: 1.9.1
Component: Core Keywords: 2nd-opinion needs-patch
Cc:

Description

I know this can be done as I've done it but it's hacky if it's not in core.

If the name field is removed then sign up should use the username as the name. Having a username and then a name field is weird and confusing for users.

Paul is doing profile field enhancements for 2.0 I thought this would be a good time to rethink if the Name field is needed.

Change History (8)

#1 @needle
11 years ago

As you probably know, you can't actually remove the default 'Name' field, but you can hide it with a plugin and sync the username to it later. Have a look at my BP XProfile WordPress User Sync plugin, which replaces the default 'Name' field with 'First Name' and 'Last Name' fields but does not alter BP core. You should be able to fork that and amend it for you own needs.

#2 @boonebgorges
11 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release

I don't think we should remove the required Name field - it's too embedded in how BP works, and would take ages to extract. But your general idea about using user_login for the display name if none is explicitly defined seems fine to me. The question is how this would be done. We appear to enforce the Name field because it's a "required" field (xprofile_check_is_required_field()). We'd need to introduce a special case for this, probably somewhere in the handler function bp_core_screen_signup().

#3 @modemlooper
11 years ago

If you change is_required in db and then just hide the field with css. The field uses username field on it's own. I'll futz around with this and at some point try and do a patch.

There should be a fail safe in place incase the field is removed via db. If it is removed sign up breaks.

Last edited 11 years ago by modemlooper (previous) (diff)

#4 follow-up: @SJS719
9 years ago

@modemlooper how do you change is_required? I cannot find anywhere in my db which shows is_required.

Thanks.

#5 in reply to: ↑ 4 @modemlooper
9 years ago

Replying to SJS719:

@modemlooper how do you change is_required? I cannot find anywhere in my db which shows is_required.

Thanks.

when you search it looks for values and is_required is the column title. It's easy to find by going to wp_bp_xprofile_fields table and find id 1 group_id 1 this is the name input it will be a type text.

one thing to note is, leave the field in the admin and hide it on the front with css. the is_required change makes it so a user does not have to enter anything

Last edited 9 years ago by modemlooper (previous) (diff)

#6 @Sim2K
8 years ago

Add this into your CSS ...

#register-page p { display: none;}
#profile-edit-form .field_1 { display: none;}
#signup_form .field_1 { display: none;}

The register section is a sweet add on that removes the standard registration join up text as many spammers search for that phrase. The rest hides the name field from view on the registration page and the update page.

Next add this Java script ....

<script>
document.getElementById("signup_username").onchange = function() {myFunction()};

function myFunction() {

var x = document.getElementById("signup_username");
document.getElementById("field_1") .value = x.value

}
</script>

.... this takes the username and populates the name field. So even though the user cant see the name field it gets updated with whatever they put in the username field.

Ideally you need to find a way to add it to just your registration field.

Last edited 8 years ago by Sim2K (previous) (diff)

#7 @ezekielloves
7 years ago

@Sim2K doesn't work.

This ticket was mentioned in Slack in #buddypress by espellcaste. View the logs.


4 months ago

Note: See TracTickets for help on using tickets.