Buddypress Author Bio Box in Post

I’m using Buddypress with WPMU-Dev Membership plugin to manage members and allowing them access to a Gravity Forms page so that they can submit articles and press releases as drafts to the site’s primary “blog.”

I’m looking for a way to include their user bio and other profile information from buddypress at the bottom of the post as an “author bio” and possibly a link to their company, twitter, etc from custom buddypress fields.

The typical “author box” plugins and programming doesn’t work because Buddypress apparently doesn’t write all of these fields to the wordpress user it creates.

Any ideas, plugins or code help?

  • Mason
    • DEV MAN’s Sidekick

    Hiya,

    I haven’t used the Gravity Forms add-on myself. Does it actually create the posts and save them as drafts? Does it assign the post to their WordPress username?

    Take a look here:

    http://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/profile-fields-questions/

    Probably something similar to this:

    <div id="member_profile">
    <!--?php if ( $data = bp_get_profile_field_data( 'field=SomeField' ) ) : ?-->
    <div class="profile_fields">
    Country: <span><!--?php echo $data ?--></span></div>
    <!--?php endif ?--></div>

    Let us know if that’s what you’re looking for (hopefully gets ya pointed in the right direction).

    Thanks!

  • Tony
    • Design Lord, Child of Thor

    Yes, Gravity Forms is great. I found it after the guy who made TDO forms recommended it on his blog.

    It creates them as drafts or published based on my settings. Likewise, even though I’m publishing the post myself, it still gives credit for the post to the original author.

    In your example above. Would I replace “SomeField” with “First_Name” or something like that?

    Thanks for your help.

  • Mason
    • DEV MAN’s Sidekick

    Hiya Tony,

    I’m actually a user of Gravity Forms as well, just haven’t had time to play with their newer addons.

    In your example above. Would I replace “SomeField” with “First_Name” or something like that?

    You got it. :slight_smile:

    Let us know how it goes for ya.

    Thanks!

  • Tony
    • Design Lord, Child of Thor

    Hey I was using a plugin for the author stuff, but it’s probably not going to work with the above code.

    Could you let me know the file name and maybe even the line number to put the above code?

    I’m using STUDIO by wpmu dev.

    Thanks!

    Tony

  • Tony
    • Design Lord, Child of Thor

    I couldn’t figure out how to program the single.php. I’m a wordpress junkie, but still not a programmer.

    I did figure out a solution though. I’m using gravity forms along with this plugin.

    http://bp-tricks.com/featured/buddypress-shortcodes-plugin/

    I have this plugin’s short codes typed as part of a template for the post body. So while, it’s not completely automated as part of the single.php… it’s automated once I approve the draft as a published post.

    It doesn’t do everything I want. But it’s better than simply being stuck.

    Eventually I want to include active links to user’s twitter, user twitter follow button, and facebook page.

  • Mason
    • DEV MAN’s Sidekick

    I like your current solution actually. It seems to do the trick.

    To use the code I mentioned above, you’d probably want to actually modify the bp_wpmu_page_loop() which is used in single.php.

    I’d do it like so:

    1. Use child theme!

    2. Copy single.php from parent theme to child theme.

    3. Open new single.php and edit line 10 to use your custom function, so something like:

    <?php tony_wpmu_singleloop(); ?>

    4. Create a new file in your child theme directory and name it functions.php

    5. Copy lines 141-162 into your new functions.php file and rename bp_wpmu_page_loop() to whatever you used in Step 3.

    6. Save everything and activate the child theme.

    If everything looks the same and loads as normal then we’re doing good so far :slight_smile:

    7. In your new functions.php file let’s look at line 15, right below “the_content” function and add our profile fields using the function I posted above. You’ll need to call for the information and then echo it out. For example, here’s what I added in my testing:

    <div class="entry">
    <?php the_content( __( 'Read the rest of this entry &rarr;', TEMPLATE_DOMAIN ) ); ?>
    <?php if ( $userData = bp_get_profile_field_data( 'field=bio' )): ?>
    <div class="avatar-summary">
    <h3><?php bp_displayed_user_fullname() ?><br/><?php _e( 'In A Nutshell', TEMPLATE_DOMAIN ) ?></h3>
    <p><?php echo $userData; ?></p>
    </div>
    <?php endif ?>
    </div>

    The above is lines 13-21 of my new single.php file. Once saved it’ll pull the “bio” field from the member’s buddyPress profile.

    You may want to set up a list and then echo out each profile field as a list item.

    Hope this helps!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.