Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: bbpress profile integrates with bp


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.

Skip to toolbar