Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to get xprofile data to show up on child blogs (e.g. Author name and bio)

  • Avatar of rsqst
    rsqst
    Participant

    @rsqst

    Hi there!

    Using Buddypress 1.2.3 on WPMU 2.9.2., I’m trying to have xprofile data for each of a child blog’s authors show up in the child blog (for example, name and bio information in a jquery slider at the top of each child blog).

    I can’t for the life of me figure out how to port xprofile data into my child blogs in an elegant way (or at all). I’m stretching my understanding of PHP, javascript and mySQL pretty thin already, and I would definitely appreciate some help. Does my request make sense?

    I’m sure this is something other buddypress users would benefit from as well.

    Thanks!

    Nathan

Viewing 18 replies - 1 through 18 (of 18 total)
  • Avatar of r-a-y
    r-a-y
    Moderator

    @r-a-y

    Look at the following function:

    xprofile_get_field_data( 'YOUR XPROFILE FIELD', $user_id )

    Avatar of rsqst
    rsqst
    Participant

    @rsqst

    Thanks!

    Forgive me for being slow on the uptake, but do I add that to functions.php and then call it somehow from the members loop?

    I’m not sure what to do with this.

    Gratefully,

    Nathan

    Avatar of Bowe
    Bowe
    Participant

    @bowromir

    Check this out:

    http://wordpress.org/extend/plugins/bp-profile-widget-for-blogs/

    That does what you want, but you can take a look at the code to modify it for your specific needs..

    Avatar of rsqst
    rsqst
    Participant

    @rsqst

    Thanks Bowe, that plugin seems to be not working in BP 1.2. The author appears to be working on a fix.

    But I will take a look at how it’s constructed.

    Thanx

    Avatar of r-a-y
    r-a-y
    Moderator

    @r-a-y

    @rsqst

    What are you trying to do?

    You can use the function above in your user blog’s sidebar or any WP template.

    eg. say you have an author with an xprofile field called “Bio”.

    $authorBio = xprofile_get_field_data( 'Bio', get_the_author_id() );

    echo 'Author's bio: '. $authorBio;

    Avatar of rsqst
    rsqst
    Participant

    @rsqst

    Thanks for your help @r-a-y

    It’s for the next version of this website: http://www.artmonastery.org

    It’s for a network of artists. Each blog will be a specific art project, and each subscriber/author will be an artist participating in that art project. Many artists will be participating in many different art projects, and I’d like their bio information to be publicly displayed on each blog/project.

    The blogs will be the public “portal” for each of the art projects, which we will us to promote the projects. The groups that are associated with each blog (with the group blog plugin) will be the internal communication tool for the artists.

    I’d like all the subscribers/authors/etc (aka artists) for a given blog (aka art project) to be listed at the top of the blog’s index.php page, with a few fields from the xprofile (bio, specialty, etc.). Ideally, I’d get them to echoed in a way that was easy to feed into a snazzy jquery slider gizmo.

    artists.

    I’m trying to build a resource for these artists that is really 1 database with many faces, and given that I love wordpress, buddypress seemed like the best way to do that. It’s just stretching my abilities, at the moment ;)

    Avatar of rsqst
    rsqst
    Participant

    @rsqst

    If you know anyone who would be interested in collaborating on this project, I could sure use help, and I think it would be an interesting test case.

    I’m a volunteer, though, so it’d have to be pro bono (until we get some grant money).

    email me: Nathan@artmonastery.org

    Avatar of r-a-y
    r-a-y
    Moderator

    @r-a-y

    I’d like all the subscribers/authors/etc (aka artists) for a given blog (aka art project) to be listed at the top of the blog’s index.php page, with a few fields from the xprofile (bio, specialty, etc.). Ideally, I’d get them to echoed in a way that was easy to feed into a snazzy jquery slider gizmo.

    Should be possible, Nathan, using some WP template tags combined with that code snippet I posted above.

    I’d help out if you can guarantee me some free lodging in that art monastery some time in the future ;)

    Avatar of rsqst
    rsqst
    Participant

    @rsqst

    Thanks r-a-y, I’ll look into that!

    Avatar of rsqst
    rsqst
    Participant

    @rsqst

    I found a solution here: http://www.code-zen.net/2009/using-custom-profile-field-data-in-buddypress-templates/

    What I needed did in fact exist in the members loop already; just needed some help identifying it.

    Line 36:

    <?php

    /***

    * If you want to show specific profile fields here you can,

    * but it'll add an extra query for each member in the loop

    * (only one regadless of the number of fields you show):

    *

    * bp_member_profile_data( 'field=the field name' );

    */

    ?>

    Avatar of rsqst
    rsqst
    Participant

    @rsqst

    By they way @r-a-y or anyone else:

    I’d help out if you can guarantee me some free lodging in that art monastery some time in the future ;)

    It looks like this is not out of the realm of possibility. Email me nathan@artmonastery.org to learn more. I’ll probably post a general work/trade offer somewhere on this forum soon.

    Avatar of @mercime
    @mercime
    Keymaster

    @mercime

    Cool one rsqst, will the Ursuline nuns be accepting male, or female guests only, at the convent? :-)

    http://wordpress.org/extend/plugins/bp-profile-widget-for-blogs/ has been updated and it’s working in child blogs.

    Cheers.

    Avatar of rsqst
    rsqst
    Participant

    @rsqst

    @mercime Male & female ;)

    Actually, the project is moving to a Franciscan monastery nearby. Either way, the real monks and nuns moved out some time ago.

    BTW, I’m still getting some errors with http://wordpress.org/extend/plugins/bp-profile-widget-for-blogs/

    Warning: array_map() [function.array-map]: Argument #2 should be an array in /wp-content/plugins/bp-profile-widget-for-blogs/bp-profile-for-blogs.php on line 110

    Warning: Invalid argument supplied for foreach() in /wp-content/plugins/bp-profile-widget-for-blogs/bp-profile-for-blogs.php on line 112

    Avatar of gregfielding
    gregfielding
    Participant

    @gregfielding

    Avatar of rsqst
    rsqst
    Participant

    @rsqst

    Avatar of rsqst
    rsqst
    Participant

    @rsqst

    Ok, I think I’m close to knowing what I want; But I don’t seem to be much closer to getting there.

    Unfortunately, I think my main problem is that the members loop isn’t flexible enough in its parameters for what I want (I want to add it to a child template and for it to automatically show the users of the current blog AND their xprofile information. Seems simple, but I’m lost).

    I could hand code in each of users ID’s and get the exact output I want, but this means I have to make a new template for each blog/”art project”, and it doesn’t update automatically when a new artist is added to a project.

    There’s hope in the group members loop (I’m using the BP Groupblog plugin, so when users join a group, they are added to a blog), but I still have to enter in the group_id manually in the template.

    <?php if ( bp_group_has_members('group_id=1') ) : ?>

    <?php while ( bp_group_members() ) : bp_group_the_member(); ?>

    <?php $authorBio = xprofile_get_field_data( 'Bio', $user_id=bp_group_member_id() );

    echo 'Authors bio: '. $authorBio; ?>

    <?php endwhile; ?>

    <?php endif;?>

    But as it is, it outputs: 11Authors bio: 10Authors bio: 9Authors bio: 8Authors bio: 7Authors bio: 5Authors bio:

    Should I scratch the whole thing and find a new route?

    Avatar of rsqst
    rsqst
    Participant

    @rsqst

    I truly appreciate everyone’s help on this, by the way. I’m learning a lot here.

    I think I’m a buddypress addict now.

    Avatar of rsqst
    rsqst
    Participant

    @rsqst

    I truly appreciate everyone’s help on this, by the way. I’m learning a lot here.

    I think I’m a buddypress addict now.

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

The topic ‘How to get xprofile data to show up on child blogs (e.g. Author name and bio)’ is closed to new replies.