How to display description under the name on the profile page
-
I’m the admin for a buddypress installation (WP=2.9.2; BP=1.2.1). I activated xprofiles and use the BP default theme.
How do you designate which field will be displayed under the name on the Profile page?
For example, within this blog, go to My Account –> Profile –> Edit Profile then populate the “About Me” field. Magically, the contents of field is “magically” displayed under your name on the profile page.
What setting triggers that field’s contents to be displayed in that location?
-
Any insight, anyone?
Read this to grab the data of a xprofile field:
https://buddypress.org/forums/topic/editing-the-core-elements-of-buddy-press#post-41651
You have two ways to add the xprofile field:
1) Hook into the profile action to display custom data (preferred)
In your child theme’s functions.php, add the following:
function my_bp_xprofile_about_me() {
bp_profile_field_data('field=About Me');
}
add_action('bp_before_member_header_meta','my_bp_xprofile_about_me');This method is preferred because you won’t have to worry about theme updates.
2) Copy /bp-themes/bp-default/members/single/member-header.php to a child theme and make your changes there
Manually add the bp_profile_field_data(‘field=About Me’) line to the file.
Thanks for this, @r-a-y
@r-a-y After doing this, how do you remove the field from also displaying below?
@scotm – Copy /bp-themes/bp-default/members/single/profile/profile-loop.php and modify to your heart’s content!
You can either delete the profile loop and input the information one by one using the technique above, or omit an item by manipulating the profile loop.
More info here:
https://codex.buddypress.org/developer-docs/custom-buddypress-loops/the-profile-data-loop-bp_has_profile/@r-a-y Using the technique above, preferred, can you also remove individual items such as the required ‘Name’ for instance? I see no reason why this field is displayed when it is provided above adjacent to the user avatar. Or am I hearing that omission must be done by manipulating the profile loop?
@scotm – You have control of the template, of course you can remove the “Name” field!
@r-a-y I’m reaching here to figure this out:
function my_bp_xprofile_name() {
bp_profile_field_data(‘field=Name’);
}
remove_action(‘my_bp_xprofile_name’);Hey @scotm – That’s not the correct usage.
What I meant was copy the the template file I listed above in your child theme and remove everything in it.
Then use bp_profile_field_data(‘field=YOURFIELD’); to list only the xprofile fields you want to list (no need to use functions and remove actions here).
The other method is using a variation of this:
https://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/faq-how-to-code-snippets-and-solutions/#post-13243@r-a-y Gotcha. Thanks for the help…
If I’m using default buddypress theme, which functions.php do i use? Is it from /public_html/wp-content/plugins/buddypress/bp-themes/bp-default/functions.php?
- The topic ‘How to display description under the name on the profile page’ is closed to new replies.