Additional Fields in Profile (but not reg form)

Hiya, I'm using BuddyPress and Membership 2 in tandem.
I'd like to be able to have additional fields in the Profile, but not see then in the Membership SignUp form.
Is that possible?
I've opened up support access if you want a look around.

  • Abdul Wajed

    Hi Rachel,

    I hope you are well today and thanks for asking. :slight_smile:

    Only the first group (Primary) fields show on the registration page. So create a New Field Group or use an existing one and drag the field onto the new sections tab that you want to hide from the registration page.

    Another way you can achieve that, place the following code in your bp-custom.php file to hide fields on the registration page.

    function buddydev_filter_register_fields( $r ) {
    	if ( bp_is_register_page() ) {
    		$r['exclude_fields'] = 2;  // Comma-separated list of profile field IDs to exclude e.g. '2,3'
    	}
    	return $r;
    }
    add_filter('bp_after_has_profile_parse_args','buddydev_filter_register_fields' );

    Hope this helps! Please let me know if you need any further assistance. :relaxed:

    Have a nice day.
    Best regards,
    Wajed

  • Rachel

    Hi Wajed, Thanks so much. Unfortunately the first option 1 didn't seem to work. Tried option to however my coding skills are practically zero.

    Here's what I put in the new bp-custom.php file
    <?php
    function buddydev_filter_register_fields( $r ) {
    if ( bp_is_register_page() ) {
    $r['exclude_fields'] = 27,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26;
    }
    return $r;
    }
    add_filter('bp_after_has_profile_parse_args','buddydev_filter_register_fields' );
    ?>

    This is the error message I'm now getting on the site.

    Parse error: syntax error, unexpected 'function' (T_FUNCTION), expecting identifier (T_STRING) in /homepages/38/d692663102/htdocs/clickandbuilds/GoalHack365/wp-content/plugins/bp-custom.php on line 10

    Please help!

    • Abdul Wajed

      Hi Rachel,

      Glad to know that you and Nahid sorted it out. You are getting the error message because you are want to hide multiple fields and when you have multiple fields then you need to use them inside quote. See the example below. Posting it because it may help someone in the future.

      function buddydev_filter_register_fields( $r ) {
      	if ( bp_is_register_page() ) {
      		$r['exclude_fields'] = '6,18,39';  // Comma-separated list of profile field IDs to exclude e.g. '2,3'
      	}
      	return $r;
      }
      add_filter('bp_after_has_profile_parse_args','buddydev_filter_register_fields' );

      Have a nice day.
      Best regards,
      Wajed

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.