Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: CubePoints and BuddyPress Intregration?


r-a-y
Keymaster

@r-a-y

Cool plugin! I’ll have to play around with this at some point.

Anyway, back to your question.

Look around the BP code and find anything that says “do_action”; this is where you can hook your functions into a BP action.

For instance, to add 10 CubePoints when creating a group, add the following to your theme’s functions.php or /wp-content/plugins/bp-custom.php.

function my_bp_create_group_add_cppoints() {
if( function_exists('cp_alterPoints') && is_user_logged_in() ){
cp_alterPoints(cp_currentUser(), 10);
cp_log('User created a group -- +10 points', cp_currentUser(), 10, 1);
}
}
add_action('groups_group_create_complete','my_bp_create_group_add_cppoints');

In this case, we hooked the cp_alterPoints() and cp_log() functions to the groups_group_create_complete hook found in /buddypress/bp-groups.php.

In the next little while, I’m going to try and add a bit of documentation to the codex.

Skip to toolbar