jeudi 1 janvier 2015

add privacy using bp_activity_add()


I want to select privacy when I am adding my new activity. I am using bp activity privacy plugin and it is working well. But what i want is that when i click on a button, I add an activty to the activity stream which is right now working pretty well. Now i want to select this new activity privacy at the time when I fill my random form and click save button. that save button is creating my new activity right now.



function onclick()
{
// Get current username and display name.
$current_user = wp_get_current_user();
$getDisplayName = $current_user->display_name;
$getUserName = $current_user->user_login;

// Get current url.
//$current_url = home_url( add_query_arg( NULL, NULL ) );

// url except page name.
global $wp;
$current_url = add_query_arg( $wp->query_string, '', home_url( $wp->request ) );

bp_activity_add( array(
'action' => '<a href="' . $current_url . '/members/' . $getUserName . '/">' . $getDisplayName . '</a> Added new activity',
'content' => $getDisplayName.' has added an activity',
'component' => 'simplepress',
'type' => 'new_forum_post',
'primary_link' => $current_url.'/exercise-log/',
'user_id' => get_current_user_id()
));
}




Aucun commentaire:

Enregistrer un commentaire