Skip to:
Content
Pages
Categories
Search
Top
Bottom

Regarding about custom field display


  • zxbchris
    Participant

    @zxbchris

    Hi,

    I have encounter an issue that I wish that I can get some help here:

    Currently I have created some custom profile field, that allows my user to input his bio and social media field. It displays at the buddypress profile page nicely. However, i will like the bio field that my user has input to be shown on the product page. You can take a look at my page, at the bottom, the “About post author” section
    http://www.chalktalk.com.sg/courses/chalktalk-demo-course/

    currently, this section is using the wordpress default description field to display it here. I will like to get the custom bio field that I created in buddypress to be display here instead. May i know how can i go by doing this? where can i retrieve the ID of my custom field to place here instead?

    Hope to hear from you soon.

    Regards

    Chris

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

  • danbp
    Participant

    @danbp

    HI,

    basically when outside of the members loop, you call a profile field value with xprofile_get_field_data() function.

    Positionning that information below a blog post depends of the theme (you’re using a premium one – so i ignore his code and can’t help). Usually, the post template has some action hooks where you can hook the bp function. If not, you create one via child-theme…

    And finally, assuming the field is called “Biography”, you have to write your own function containing at least something like:

    $user_id = get_the_author_meta( 'ID' );
    
    $bio = xprofile_get_field_data( 'Biography', $user_id );
    
    echo $bio;

    zxbchris
    Participant

    @zxbchris

    Hi,

    Thanks for your prompt response.

    Do you mean that, as I know where does the theme call it, which i found it :

    <div class=”gdlr-post-author-inner”>
    <div class=”post-author-avartar”><?php echo get_avatar(get_the_author_meta(‘ID’), 90); ?></div>
    <div class=”post-author-content”>
    <h4 class=”post-author”><?php the_author_posts_link(); ?></h4>

    <?php echo get_the_author_meta(‘description‘); ?>
    </div>
    <div class=”clear”></div>
    </div>

    the ‘description’ is the place where it called the default wordpress User description.

    So now I will like to replace it with the custom field that I created, which i think its called field_2, do I need to create one php in the theme with this function:

    $user_id = get_the_author_meta( ‘ID’ );

    $bio = xprofile_get_field_data( ‘field_2’, $user_id );

    echo $bio;

    and use the bio created here to replace with the description above?

    Sorry that my php knowledge is quite limited, Hope you can help me in this 🙂

    Thanks!


    zxbchris
    Participant

    @zxbchris

    Or maybe is there a way that I can link the default wordpress description to the custom field created in BBPress?

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.