[Resolved] Display profile fields to user profile page …how to
I’m trying to display certain profile fields on the user’s profile page. I tried the help document about Carlos and his favorite color on buddy press’s site but it did not work for me. Does any know how to do this the correct way with the modern version of buddypress? Would be a huuuuge help! Thanks!! Also would be cool to include social media link in the user’s profile page too–tried that help document on here as well to no avail.
Hope all is well!
I did something similar to you, I made a whole new profile page though, for my users.
First off, do you have xProfile Fields installed and active? You’ll need that.
Take a look at the page I’m working on currently: http://ishocase.net/members/chiherah/
Hi @butlerweb thanks for the response!
I’m not using xprofile fields because I didn’t want to add a birthdate field and whatnot, just wanted to display my current profile extension fields. Is that not possible without the install of xProfile Fields?
Possibly! what ‘current profile extension fields’ do you have or are you working with.
I only recommend xProfile Fields because I know how to use the hooks! Haha 🙂
@butlerweb Nice, thanks! I’m using whatever came with wordpress and buddypress, no extra plugin. I’m always afraid of slowing down the site speed when installing and activating plugins to be honest.
Haha I have about 47 different plugins installed into my site and it runs fairly smoothly. The only thing is my geolocation plugin causes my page to refresh the first time you view it.
Aside from that, I found this article: http://bp-tricks.com/snippets/displaying-certain-profile-fields-on-your-members-profile-page/
In step 2 it shows PHP code to grab profile field data. You’ll have to either edit the template you want or create your own tab if you want it on a new page besides one of the pages you already have up on your site.
As far as adding social icons, I used this tutorial: https://buddypress.org/support/topic/display-users-social-follow-buttons-in-profile/
But that one requires xprofile fields.
Hope that helps some! 🙂
I tried the social media earlier and it didn’t seem to work. I wrote the forum and received a response so am going to try again.
As for the other link — yup been there too. Do you have to include a “do_action” in that code? Because it doesn’t seem to work for me wither. I’m using a field with multiple check boxes so I wonder if that’s the issue? Although on your site, I think I see a mulitcheck box section in your “arts subcategories” section, no? Thanks again.
Where are you putting your code? Directly in the template file or elsewhere?
And mine were Multiselect boxes, rather than checkboxes, but it should give you the same array output. For those, I had to parse the strings into something a bit more readable.
Again, I use xprofile fields, but this is what my code looks like:
<h4><strong>Arts Subcategories:</strong> <?php echo (implode( ', ', (array) xprofile_get_field_data ('Arts Subcategories'))); ?></h4>
I did not want to edit template files so I used a plugin called ‘Code Snippets’ which allows me to write code without editing the theme’s functions.php file or, like I said, the BP template files. However, to add them to the pages I had to use the “add_action()” hook.
@butlerweb that’s a good call on the plugin Code Snippets — sounds like a really useful plugin.
Okay, so using the code from the link you gave me (which should be added to the buddypress member header file):
<div class=”profile_fields”>Category: <span><?php bp_profile_field_data( ‘field=Category’ );?></span></div>
If the Category Field was an array (a multicheck boxes), would this code be different, do you know? Maybe this is the issue I’m running into to.
I would be adding the code directly into the member header file for now. I’ll switch things over once I get the code snippets plugin that you recommended, but for now I’ll just add it directly into the buddypress file where the article tells me to.
Looks also like you’re missing an ending div tag (from what you copied&pasted) If that end div tag for the “member_profile” class is there, then that should work… As long as the field name is ‘Category’.
It just might be because it’s a multi check box, though! If that’s the case, I don’t know if there is a way to pull that information.
Also, be careful when copying and pasting code that your quotation marks aren’t fancy quotes. That will mess it up sometimes, I’ve noticed.
well i pasted the following code into the member-header.php file in buddypress where it says to add code and still no luck.
<div id="member_profile"> <div class="profile_fields">Position <span><?php bp_member_profile_data( 'field=Position' );?></span></div> </div> <?php /*** * If you'd like to show specific profile fields here use: * bp_member_profile_data( 'field=About Me' ); -- Pass the name of the field */ do_action( 'bp_profile_header_meta' ); ?> Any ideas?
- The topic ‘[Resolved] Display profile fields to user profile page …how to’ is closed to new replies.