Skip to:

add privacy using bp_activity_add()

  • imransilvake


    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.

        // 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()
Viewing 1 replies (of 1 total)

  • Henry Wright


    Setting hide_sitewide to false will allow you to hide the activity item from the site-wide activity stream. Is that what you’re trying to do?

Viewing 1 replies (of 1 total)
  • The topic ‘add privacy using bp_activity_add()’ is closed to new replies.
Skip to toolbar