Skip to:
Content
Pages
Categories
Search
Top
Bottom

triplicate activity_update

  • Avatar of tchburn
    tchburn
    Participant

    @tchburn

    I am using the code below to create an activity feed post when a user submits a form. It works, but creates three activity posts instead of one. I think I have added the code in the wrong place, can anyone help?

    $current_user = wp_get_current_user();
    $user_login =  $current_user->user_login;
    $username =  $current_user->user_firstname ;
    global $bp;
    $userlink= 'http://localhost/wordpress/member/'.$user_login;
    $action = '@'.$username.' has just submitted a review on PAGENAME in CATEGORY';
    global $bp;
    bp_activity_add (
    array(
    'action' => $action,
    'primary_link' => $userlink,
    'component' => 'activity',
    'type' => 'activity_update',
    'user_id' => $bp->loggedin_user->id,
    'item_id' => $bp->displayed_user->id
    )
    );

    at the moment it is in the page that contains the form being used, is this not correct?

You must be logged in to reply to this topic.