Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Adding a second element for posting with an activity.


gabrielcrowe
Member

@gabrielcrowe

oh lordy, i think i sorted it, and for those interested, here is the deal:

– in post-form.php, i have another input field with the ID: ‘trackstr’

– create a plugin in wp-content/plugins: ‘bp-custom.php’

– customise the below function to your custom capture needs:

function add_trackmeta_to_activity( $content, $user_id, $activity_id ) {

bp_activity_update_meta( $activity_id, ‘trackmd5’, md5($_POST[‘trackstr’]) );

}

add_action( ‘bp_activity_posted_update’, ‘add_trackmeta_to_activity’, 10, 3 );

function my_trackmeta() {

$my_trackmeta = bp_activity_get_meta( bp_get_activity_id(), ‘trackmd5’ );

//if (is_user_logged_in()) : {

echo ‘<span class=\’trackmeta-md5\’>(‘ . $my_trackmeta . ‘)</span>’;

//}

//endif;

}

add_action( ‘bp_activity_entry_meta’, ‘my_trackmeta’ );

… additional metadata is captured and stored with your posts.

sorry for not searching and readin up on this before i jumped in and gave it a go chaps and chapettes, but here is how i solved my own problem anyhow. :)

Skip to toolbar