Skip to:
Content
Pages
Categories
Search
Top
Bottom

bbpress profile integrates with bp


  • ozpoker
    Participant

    @ozpoker

    Although bbpress is slightly integrated – is is possible to link bbpress member profiles to back to their bp memebr page?

    is there a plugin or something?

Viewing 25 replies - 1 through 25 (of 29 total)

  • John James Jacoby
    Keymaster

    @johnjamesjacoby

    I am using the “Post Counts Plus” plug in for bbPress in conjunction with the new Group Forums BuddyPress plug in, and they seem to play nice together to do what you’re asking about.


    ozpoker
    Participant

    @ozpoker

    cool thanks – i’ll do a search for it


    terryjsmith
    Participant

    @terryjsmith

    You could write your own simple plug-in for this as well; whenever you call user_profile_link it applies the filter ‘user_profile_link’. So you could create a plug-in with the following:

    bb_add_filter(‘user_profile_link’, ‘bppro_user_profile_link’);

    function bppro_user_profile_link($link, $uid) {

    return(bb_get_option(‘wp_siteurl’).’/members/’.bb_get_user($uid));

    }

    This is of the top of my head but I think that’s right.

    Hope this helps,

    Terry


    terryjsmith
    Participant

    @terryjsmith

    Correction to the above code, this is tested:

    add_filter(‘get_user_profile_link’, ‘bppro_user_profile_link’, 10, 2);

    function bppro_user_profile_link($link, $uid) {

    $user = bb_get_user($uid);

    return(bb_get_option(‘wp_siteurl’).’/members/’.$user->user_login);

    }

    Terry


    ozpoker
    Participant

    @ozpoker

    Thx guys – I’ll give them a try


    ozpoker
    Participant

    @ozpoker

    Thx that worked good. How would I drag the bp avatar across to bbpress?


    Burt Adsit
    Participant

    @burtadsit

    ozpoker, if you are using the bbGroups plugin the avatar is available to you. See the readme.txt for some info on the template tags that are included. One is oci_user_avatar(). It comes across and gets put in bbpress user meta data.


    ozpoker
    Participant

    @ozpoker

    ahh – yes thx


    ozpoker
    Participant

    @ozpoker

    Can I please ask someone to point me in the right direction with this.

    I have implemeted a theme and can get the bbpress profile avatar next to each users post using this code :

    <?php if ( $avatar = bb_get_avatar( $user->ID ) ) : ?>
    <div id="useravatar"><?php echo $avatar; ?></div>
    <?php unset($avatar); endif; ?>

    But I can’t get the oci_user_avatar() tag in there without errors. probably I should be putting somewhere else so it qwrites directly in to the “bb_avatar”, but I got no idea.

    Anyone want to help an idiot?


    Burt Adsit
    Participant

    @burtadsit

    ozpoker, this really isn’t the place to do support for the bbGroups plugin. This is for bp itself. Create an account on my site and join the group ‘CommonInterest Code’ I can help you out there.

    http://ourcommoninterest.org


    ozpoker
    Participant

    @ozpoker

    oh okay – yes of course – thx


    gpo1
    Participant

    @gpo1

    @burtadsit, You have a cool site,but its not private for members. Is that meant be?


    Burt Adsit
    Participant

    @burtadsit

    Not private? No it’s a completely open site. It’s been an experimental development site up to this point. I’m rushing around trying to undo all the experimental stuff and turn it into a real website now. Have to do that to do support for plugins. :)

    It’s always going to be kind of unstable. I test alot of ideas there.


    gpo1
    Participant

    @gpo1

    I know there’s a plugin or script to make members and groups private. I can’t find it or how is it done?


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    Burt, is there any way to add info to the bbGroups array from the extended profile area to be available inside bbPress? Or is there a different method to do this easily? I noticed that the extended profile data in the DB isn’t stored as simply as the user-meta table is, rather each entry associates itself with a corresponding value in another table.

    Say for example in the extended profile area, I want to have “aim, yahoo, google talk” fields, and I want each post in bbPress to have links to what each author entered in extended profile. Possible? :D


    Burt Adsit
    Participant

    @burtadsit

    Hi John, sure it’s possible. bbGroups sends over an associative array of user info. I’ll add a filter mechanism to allow people to add or modify the data going across to bb. On the bb side that entire array just gets stuffed into user meta. Doesn’t care or look at what it is. It just gets pulled out in a chunk from user meta with the key ‘bbGroups’.

    Gimme a few to implement that and I’ll upload that version to my site.


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    That will be super slick of you. I’ve tried scanning through some of the code, and to be honest the only way that I would know how to do it would be through making a new BP_XProfile_ProfileData object and getting the data that way, which I would rather not add a new query to every user on the page if I can help it.


    Burt Adsit
    Participant

    @burtadsit

    I didn’t have time to dig through the xprofile component to do exactly what you want but I did have time to do this. I added a filter to the group and user data that goes across to bbpress. There are two fns that build the associative array of info that goes across and gets stuffed into bbpress forum and user meta tables.

    I added the filter ‘oci_get_user’ to the oci_get_user() fn and ‘oci_get_group’ to the oci_get_group() fn. I also did a little demo of how to create such a filter for any data you want to go across to bbpress. I pulled the user’s forum list and the list of forums where the user is ‘staff’ and implemented that as a filter. It doesn’t get created or include by the fn I created for that purpose anymore. It uses a filter. oci_get_user() builds and includes info from the bp user obj and then calls the filter for the added and needed forum info.

    /**

    * oci_get_user_filter()

    *

    * Live example of how to use the filter mechanism to add info to the data going across to bbpress

    * This filter adds the user’s forums and forums where the user is staff into the $user array

    * @return

    * @param associative array $user from oci_get_user()

    */

    function oci_get_user_filter($user){

    $users_group_info = oci_get_users_group_info($user);

    $user = $users_group_info;

    $user = $users_group_info;

    return $user;

    }

    add_filter(‘oci_get_user’,’oci_get_user_filter’,10,1);

    The data being stuff into the $user array used to be included in the oci_get_user() fn and now it’s being included in that filter.

    You just need to create your own filter fn and trap the ‘oci_get_user’ filter chain like I did above. The zip with the new capability is available on my site as:

    http://ourcommoninterest.org/downloads/bp_group_forums_0.24.zip

    I didn’t bump the ver number, change the readme.txt or update the plugin’s blog post yet. This reply is the docs for the moment. :)

    You have to be careful what you send across. Only primitive types can go over through xmlrpc. No objects. int, string, bool, array…


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    Wow that’s cool… So if I understand correctly, the idea would be to add another function inside the oci_get_user_filter function that would get the xprofile info that I’m looking for? This way it exists within the bbGroups array for later access versus having to pull the query everytime?

    I get the feeling that getting the xprofile info might be harder than I thought.

    Also for the sake of those of us using deep integration, in oci_bp_group_forums.php if I could ask you to do…

    if (!defined(BBDB_NAME))
    require_once(ABSPATH . WPINC . '/class-IXR.php');

    That helps check to make sure that it isn’t previously included anywhere… Require_once doesn’t seem to really cut it with deep integration…


    Burt Adsit
    Participant

    @burtadsit

    Create a file called oci_bp_custom.php and put it in the same dir as oci_bp_group_forums.php. Create a filter like:

    function johns_filter($user){

    $user = “johns info going across to bbpress and bb user meta”;

    return $user;

    }

    add_filter(‘oci_get_user’,’johns_filter’,10,1);

    This traps the filter you want ‘oci_get_user’ with add_filter(). It says trap that filter and call the function ‘johns_filter’ we just created. Give this filter a priority of 10 which is normal and the function johns_filter() takes one parameter.

    The $user array that johns_filter() gets when called contains the user id as $user that was built in my fn oci_get_user(). Anybody can create more filters now and add more info that goes across and gets associated with every user.

    Once you import again all your new info will get put into meta data for use each time the ‘bbGroups’ info gets pulled out for the current user. This plugin was designed for people who are not running deep integration. It works for you but frankly the xmlrpc overhead is not needed. You have access to all the bp data and functions. One thing you might run into is that the data you are trying to get at and the functions are not initialized yet by the bbGroups plugin. I only fire up the global vars for the components I need. I just do:

    function oci_bp_group_forums() {

    // only do this if the xmlrpc server is firing up and we are servicing a request

    if ( defined(‘XMLRPC_REQUEST’) && XMLRPC_REQUEST ){

    // bp’s globals don’t get set until a ‘wp’ action occurs. this seems to be all that is needed.

    bp_core_setup_globals();

    groups_setup_globals();

    bp_activity_setup_globals();

    }

    }

    add_action(‘init’,’oci_bp_group_forums’);

    That gets core, groups and activity globals initialized. You are going to have to fire up the xprofile globals yourself:

    xprofile_setup_globals();

    Well, hang on a sec and I’ll include that in my ‘init’ handler.


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    That makes sense. I’m actually using a modified version of your oci_bp_custom.php that you linked me to previously, and I think I have a good understanding of how they all work together.

    The problem is going to be getting the xprofile fields and data that I want to use, since there doesn’t seem to be a function that says “get all the users extended field data.”

    I guess what I’m running into is that the xprofile data doesn’t seem to be in a variable or a global anywhere, because it isn’t really considered meta. It’s kinda like how $bp doesn’t carry around all of the messages in your inbox on every page load, it also doesn’t carry around all the xprofile fields.

    Deep integration actually starts WPMU and BuddyPress before it ever touches bbPress, so all of the functions and variables and data I need and can access seem to be available within bbPress.


    Burt Adsit
    Participant

    @burtadsit

    Ok John. If you downloaded that 0.24 zip do it again. The one on the net has initialization of globals for all components now. Except the forums component. It does something that I don’t have time to investigate right now and I don’t know the exact implications of it.


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    Also in oci_bb_group_forums.php, I added…

    if (defined(BACKPRESS_PATH))
    require_once( BACKPRESS_PATH . '/class.ixr.php' );

    Does the same thing on the bbPress side…


    Burt Adsit
    Participant

    @burtadsit

    The problem using xmlrpc is that it doesn’t trigger the ‘wp’ action that bp wakes up to. I had no intention of doing so myself at the time of writing bbGroups. I didn’t know what kind of mayhem that might entail. I was trying to be as minimally invasive as possible and not cause more problems than I usually do. :)


    Burt Adsit
    Participant

    @burtadsit

    Ya. Gotta do that too. User had a problem with the sequence of plugin inits. That’s the solution thanks.

Viewing 25 replies - 1 through 25 (of 29 total)
  • The topic ‘bbpress profile integrates with bp’ is closed to new replies.
Skip to toolbar