Hmm –
I’ve got a plugin that basically is a voting / poll plugin. Upon someone voting on a post I’d like to do a *user* voted on *poll name* / link to single — (it does use a custom post type but the examples that show activity based upon a post publishing aren’t valid). I’m having a bit of a brain fart trying to get this to work because the examples I see it’s not clear how to actually INITIATE said activity. i.e.:
I set this up:
function bp_example_record_activity( $args = ” ) {
global $bp;
if ( !function_exists( ‘bp_activity_add’ ) )
return false;
$defaults = array(
‘id’ => false,
‘user_id’ => $bp->loggedin_user->id,
‘action’ => ”,
‘content’ => ”,
‘primary_link’ => ”,
‘component’ => $bp->example->id,
‘type’ => false,
‘item_id’ => false,
‘secondary_item_id’ => false,
‘recorded_time’ => gmdate( “Y-m-d H:i:s” ),
‘hide_sitewide’ => false
);
$r = wp_parse_args( $args, $defaults );
extract( $r );
return bp_activity_add( array( ‘id’ => $id, ‘user_id’ => $user_id, ‘action’ => $action, ‘content’ => $content, ‘primary_link’ => $primary_link, ‘component’ => $component, ‘type’ => $type, ‘item_id’ => $item_id, ‘secondary_item_id’ => $secondary_item_id, ‘recorded_time’ => $recorded_time, ‘hide_sitewide’ => $hide_sitewide ) );
}
Then do I call via bp_example_record_activity( array( ‘type’ => ‘new_highfive’, ‘action’ => ‘Andy high-fived John’, ‘user_id’ => $bp->loggedin_user->id, ‘item_id’ => $bp->displayed_user->id ) );
Thanks for any links, tutorials, info, ancient chinese secrets.