can you add custom fields when using the standard BP registration page?

how do you create custom fields when using the BP standard registration page?

  • Timothy Bowers

    Hey there.

    You can create custom xProfile fields with the BuddyPress feature:

    Admin --> Network Admin (if applicable) --> Settings --> BuddyPress --> Components [TAB]

    /wp-admin/network/settings.php?page=bp-components

    You need to have "Extended Profiles" enabled and then you can create custom profile fields here:

    Admin --> Network Admin (if applicable) --> Users --> Profile Fields

    Take care.

  • thevillageblog

    Thanks I looked at Boone but was not clear how to implement.
    I looked at the /members/single/profile/edit.php and /registration/register.php and found the line of code he is referring to but then he mentions copying the relevent code from bp-default and that is where he loses me.

    I found the bp-xprofile-loader.php and found the following code and changed it but it does not have any affect on the user profile fields when we tested it.

    // Register the visibility levels. See bp_xprofile_get_visibility_levels() to filter
    		$this->visibility_levels = array(
    			'public'  => array(
    				'id'	=> 'admins-only',
    				'label' => __( 'Admins Only', 'textdomain' )
    			),
    			'loggedin' => array(
    				'id'	=> 'loggedin',
    				'label' => __( 'Logged In Users', 'buddypress' )
    			)
    		);
    
    		if ( bp_is_active( 'friends' ) ) {
    			$this->visibility_levels['friends'] = array(
    				'id'	=> 'friends',
    				'label'	=> __( 'My Friends', 'buddypress' )
    			);
    		}

    Also the php code he shows on his site doesn't explain if I am to install it somewhere or does it need to be added to existing code in a file.

    Could you please point us in the right direction?

    His site refers you to this post for additional info.
    https://bpdevel.wordpress.com/2012/03/16/profile-field-visibility-in-bp-1-6/

    Thanks again!

  • thevillageblog

    HelloTimothy,

    Yes, we are still having problems here...

    We loaded the plugin in our test site and yes, it works in so far as the user can dictate during the registration process who sees what. YAY!

    However, we want only the usernames to be visible by "anyone" and the members details and account info to be viewable by the admin only. I tried removing the other options as per the instructions and ended up with a parse error on line 77... which means what exactly? :slight_frown:

    What this plugin doesn't do is change the Name (Primary)(Required) of the Base Group to be viewable by admin only. While we want their real names on the back end, we don't want them visible to all.

    Also, changing the profile fields is fine but how do we change or add to the account fields? Or is it better to not mess with that side?

    Please advise... I don't believe I am understanding the instructions correctly... I want the default to be admin only and the real name to not be viewable.

    Thank you in advance for your help.

  • Timothy Bowers

    Hey.

    I tried removing the other options as per the instructions and ended up with a parse error on line 77... which means what exactly? :slight_frown:

    I don't know, you didn't provide the actual error or code?

    Also, changing the profile fields is fine but how do we change or add to the account fields? Or is it better to not mess with that side?

    I'm not fully sure what you mean here? Could you please elaborate further?

    Thanks.

  • thevillageblog

    Hello,

    I don't know, you didn't provide the actual error or code?

    I believe I understand the error I made that created the error message. I thought I was removing something when instead I was telling it to replace three separate things with one and confused it. So please disregard that part... although I am still looking for the solution to make 'Admins Only' the only option anyone has so that all the information is private except the Username.

    What this plugin doesn't do is change the Name (Primary)(Required) of the Base Group to be viewable by admin only. While we want their real names on the back end, we don't want them visible to all.

    Still trying to figure this out as well.

    I'm not fully sure what you mean here? Could you please elaborate further?

    When you register, you have to fill in Account Details and Profile Details. We did not set this up like this but cannot see how to change it (if possible). See attached example. We have the same question out to WP and BP but no response from them yet on this either.

    Thank you for any advice you can give.

  • Timothy Bowers

    Once you create the custom Visibility you should be able to force it from the profile field admin area. See screenshot

    Admin --> Network Admin (if applicable) --> Users --> Profile Fields.

    "Enforce the default visibility for all members"

    That forces them to use the default. So if you set the default to Admin Only, that's all they can have.

    When you register, you have to fill in Account Details and Profile Details. We did not set this up like this but cannot see how to change it (if possible). See attached example. We have the same question out to WP and BP but no response from them yet on this either.

    That's just the form created by BuddyPress. As soon as you activated BuddyPress you then make some new pages, one of them is for registration and this is what you're seeing. Custom Fields appear there as well.

    Take care.

  • thevillageblog

    Hi Timothy,

    I noticed "Enforce the default visibility for all members" right before I saw your email and was already changing and testing it. However, when I look at the registration page that the public sees, even though they can no longer change any option, and even though I set it to "Admins Only" in the Profile Fields it still shows on the registration form that "Anyone" can see that field... So now I'm trying to find how I can make that invisible or have it say Admins Only. Ultimately, I would prefer that it showed nothing on the registration page if it is already supposed to be an Admins Only item but I haven't been able to find that code yet. I'm also researching the BP forums to see if anyone else had the same issue but haven't found it there yet either.

    Thanks for your help. :slight_smile:

  • Timothy Bowers

    If you don't want the extra fields on the signup form in Membership then from:

    Admin --> Membership --> Options

    You could change from using the original form to use the popup form. That one doesn't include all the BP fields.

    So the visibility on the reg form, well that does seem to be a bug there. You could hide those items with some simple CSS in your theme:

    .field-visibility-settings-notoggle, .field-visibility-settings-toggle{display:none;}

    Would that now work for you?

    Take care.

  • thevillageblog

    Hi Timothy,

    Yes we went into the code and we were able to hide the writing underneath that said that the field was visible to "Anyone."

    We still would like a solution at some time to why the Name (Primary)(Required) cannot be changed out for something else, like the Username... but in the meantime, we just tell people that they can hide their names themselves if they choose to within the "My Account" after they've registered. Not the best solution maybe but it will do until we can find the answer.

    You have been so helpful and patient with us. We truly appreciate your help. Thank you.

  • Timothy Bowers

    We still would like a solution at some time to why the Name (Primary)(Required) cannot be changed out for something else,

    Sorry I missed that.

    This is the default profile for BuddyPress and I believe it relates to the WordPress Display field. So it doesn't get edited.

    And as it is default/required you can't just remove it. You're not the only one who would like this:

    http://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/removing-primary-display-name-profile-field/

    Unfortunately this would require so custom development.

    But.... You just don't want people seeing this from the front anywhere right?

    So how about leaving it there on registration, but hiding from display with a little custom CSS?

    If so:

    .field_display-name{display:none;}

    That would hide display name field from the BP profile area.

    You have been so helpful and patient with us. We truly appreciate your help. Thank you.

    You're most welcome! :slight_smile:

    Take care.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.