Custom Profile Fields Not Showing

Hey folks,

Once again I've found another of your themes that doesn't show Xprofile Custom Fields Type profile fields. This time it's BuddyPress Corporate, you can see it not working at Leet Link. If you want a demo account, just ask, I'll happily set one up! :wink:

If you could fix this, I'd appreciate this and I suspect others would be grateful as well. :smiley:

Nathan P.
President, CEO, and Founder, Leet Link

  • Ash
    • WordPress Hacker

    Hello @Nathan

    I hope you are well today and thanks for asking the question.

    Buddypress Xprofile Custom Fields Type plugin creates some extra input type that are not buddypress default. BP corporate theme is developed based on buddypress, not on that plugin. So, the theme doesn't recognise new input types.

    But you can make it enabled. If you please go ti /wp-content/themes/bp-corporate (or child)/members/single/profile/edit.php line no 24, you can see like:

    <?php if ( 'textbox' == bp_get_the_profile_field_type() ) : ?>
    
    					<label for="<?php bp_the_profile_field_input_name(); ?>"><?php bp_the_profile_field_name(); ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ); ?><?php endif; ?></label>
    					<input type="text" name="<?php bp_the_profile_field_input_name(); ?>" id="<?php bp_the_profile_field_input_name(); ?>" value="<?php bp_the_profile_field_edit_value(); ?>" <?php if ( bp_get_the_profile_field_is_required() ) : ?>aria-required="true"<?php endif; ?>/>
    
    				<?php endif; ?>

    Make a copy of it, and paste below that block. Now change the textbox to new input type, e.g. email. So it should look like with email type:

    <?php if ( 'email' == bp_get_the_profile_field_type() ) : ?>
    
    					<label for="<?php bp_the_profile_field_input_name(); ?>"><?php bp_the_profile_field_name(); ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ); ?><?php endif; ?></label>
    					<input type="text" name="<?php bp_the_profile_field_input_name(); ?>" id="<?php bp_the_profile_field_input_name(); ?>" value="<?php bp_the_profile_field_edit_value(); ?>" <?php if ( bp_get_the_profile_field_is_required() ) : ?>aria-required="true"<?php endif; ?>/>
    
    				<?php endif; ?>

    You will get the input type if you call bp_get_the_profile_field_type() in the edit.php page, see which types it is showing, then remove bp_get_the_profile_field_type() and use that type.

    Please let me know if you find this is helpful, or if you have any further questions.

    Cheers
    Ash

  • Nathan Pinno
    • The Incredible Code Injector

    Just curious if you guys have added the new hook "bp_custom_profile_edit_fields_pre_visibility" yet to your BuddyPress themes? It's supposed to make this plugin work (among others) properly.

    If it's not, I strongly suggest you guys add it. It's of BP 1.7, and you're supposed to be compatible with 1.8.1.

    Just thought I'd point this out before I did any edits myself!

  • Alexander
    • DEV MAN’s Mascot

    Hey @Leet Link Enterprises Inc.,

    Been looking into this. In BuddyPress 1.9 the standard profile fields are working ok.

    The hook is more optional though, and would be best if you added it in a child theme to support the 3rd party profile plugin. Just copy edit.php into the same folder location in the child theme, and it will honor any changes you make there.

    Best regards,

  • Nathan Pinno
    • The Incredible Code Injector

    @Alexander:

    Can you tell me on what line of code the visibility settings are on for those two files? I'm looking at register.php at the moment and can't find that, I need to add the hook before that line of code. (I'd wager it's in the same place for all your BP themes, correct?)

    Thanks,
    Nathan P.

  • Alexander
    • DEV MAN’s Mascot

    Hi @Nathan Pinno,

    Edit, sorry, last version of this post was incorrect.

    In the current version of BuddyPress, take a look at these two files:

    /bp-themes/bp-default/registration/register.php
    bp-themes/bp-default/members/single/profile/edit.php

    They show the correct usage of the hook and where to place it.

    <?php do_action( 'bp_custom_profile_edit_fields_pre_visibility' ); ?>

    Best regards,

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.