WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
function my_bp_nav_adder() 
    'name' => __('information', 'buddypress'), 
    'slug' => 'info', 
    'position' => 15, 
    'show_for_displayed_user' => true, 
    'screen_function' => 'all_conversations_link', 
    'default_subnav_slug' => 'testing', 
    'item_css_id' => 'all-conversations' 
// Load a page template for your custom item. You'll need to have an item-one-   template.php and item-two-template.php in your theme root.
function all_conversations_link () {


add_action( 'bp_setup_nav', 'my_bp_nav_adder' ); 

I am trying to display some value of custom fields in the tab that I have just created called information. I have created custom profile fields called location. using this code I am fetching the value


//code inside the directory loop

$location= xprofile_get_field_data( "Contact Person" ,bp_get_member_user_id());//fetch  the text for location
echo " $location ";


However I get this to be a broken page.I do get the output but it is displayed at the top of the page.How to correctly format these values to fit in line and diplay like the profile

share|improve this question

closed as off-topic by Pieter Goosen, birgire, toscho Aug 4 '14 at 20:58

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

up vote 0 down vote accepted

The problem is that you're not specifying which template BuddyPress should use to display your content. There are a couple of ways to do it (see https://github.com/boonebgorges/buddypress-skeleton-component/blob/master/includes/bp-example-screens.php for a few options), but I suggest the following

// This is the screen_function called in bp_core_new_nav_item()
function all_conversations_link() {
    add_action( 'bp_template_content', 'all_conversations_content' );
    bp_core_load_template( 'members/single/plugins' );

// This is the function that actually contains your content
function all_conversations_content() {
    $location= xprofile_get_field_data( "Contact Person" , bp_get_member_user_id());//fetch  the text for location
    echo " $location ";
share|improve this answer
Thanks. Solved . I hope I accepted your answer and thats all that needs to be done – Sam Apr 14 '12 at 8:05

Not the answer you're looking for? Browse other questions tagged or ask your own question.