Profile Fields Questions
-
Question #1:
I am using the following technique to get single profile values for members pages.
This in “bp-custom.php”:
// Get single value from profile fields
function custom_xprofile( $field ) {
echo bp_custom_get_member_list_xprofile_data( $field );
}
function bp_custom_get_member_list_xprofile_data( $field ) {
global $site_members_template;
return xprofile_get_field_data( $field, $site_members_template->member->id );
}
And this is the snippet for an “About me” widget:
<?php if ( bp_has_profile('profile_group_id=7') ) : ?>
<h3>About me:</h3>
<?php custom_xprofile('About me') ?>
<?php endif; ?>
I get the value right, but the problem is that on members profile that DIDN’T fill in the “About me” field, the heading (h3) “About me” still shows. Not the value, just the heading.
Is there something wrong in my conditional statement?
Here’s my structure for the sidebar (I want some widgets on all pages and profile fields widgets on members pages):
<?php if (!bp_is_member()): //if not profile ?>
// widgets
<?php else: ?>
<?php if ( bp_has_profile('profile_group_id=7') ) : ?>
<h3>About me:</h3>
<?php custom_xprofile('About me') ?>
<?php endif; ?>
// other widgets
<?php endif; ?>
- The topic ‘Profile Fields Questions’ is closed to new replies.