Skip to:
Content
Pages
Categories
Search
Top
Bottom

Create new template which can display member profile fields

  • bp_displayed_user_fullname();

    bp_get_profile_field_data( ‘field=Location’ );

    I am currently using these functions in members/single/member-header.php and they are working great.

    However, I just created a new php file “members/single/member-overview.php” and when I try to insert these functions in there nothing shows up. What can I be doing wrong?

    The reason for creating member-overview.php is i’d like to reuse its contents in a few places using something like:

    locate_template( array( ‘member-overview.php’), true );

Viewing 5 replies - 1 through 5 (of 5 total)

  • shanebp
    Moderator

    @shanebp

    So overview.php creates some html that you want to reuse in various template pages ?

    You probably better off just creating a function in bp-custom.php.
    Then call that function wherever you like.

    Thanks shanebp but I do need to create members-overview.php.

    How can I insert profile data into this file once i’ve created it?

    bp_get_profile_field_data( ‘field=Location’ ); doesn’t seem to work so I am assuming I need to have a loop somewhere which makes the profile data available to that file?

    Hope someone can give me some pointers on this?


    shanebp
    Moderator

    @shanebp

    Are you sure members-overview.php is loading ?
    Do a simple echo in that file to check.

    also try : locate_template( array( ‘members/single/members-overview.php’), true );

    members-overview.php only loads when i put locate_template( array( ‘members/single/members-overview.php’), true ); into member-header.php and then display the member profile page.

    I need to get members-overview.php to work outside the loop. The idea is to be able to display profile fields anywhere and not just display them on the member profile page.


    shanebp
    Moderator

    @shanebp

    If you’re trying to load members-overview.php as a separate page, take a look at this plugin:
    https://wordpress.org/extend/plugins/allow-php-in-posts-and-pages/

    If not, then use the bp-custom approach I mentioned above – you’ll need to learn it anyway.

    Basically, you need to ask better questions, ie. what, where – exactly, why etc.
    Use http://pastie.org/ and show your code.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Create new template which can display member profile fields’ is closed to new replies.
Skip to toolbar