Skip to:
Content
Pages
Categories
Search
Top
Bottom

bp_activity_add not working


  • mikegarlick
    Participant

    @mikegarlick

    Ok so here is my code for adding an activity feed on the submission of a form i have. NOthing happens what so ever on the form submission. Can anyone help?

    Im using wordpress 3.5 and buddpress version 1.6.2

    
    $project_link = 'http://www.example.com/member/'.$user_name.'/portfolio/view/?project='.$project_id.'';
    	
    $params = array(
        'action' => 'new-project',
        'content' => 'here is a new activity',
        'primary_link' => $project_link,
        'component' => 'my_component',
        'type' => 'my_type',
        'user_id' => $bp->loggedin_user->id,
        'item_id' => $bp->displayed_user->id
    );
    do_action( 'bp_activity_add', $params );
Viewing 6 replies - 1 through 6 (of 6 total)
  • Does the new item get added to the DB?


    mikegarlick
    Participant

    @mikegarlick

    yeah it does but it doesn’t show up on the activity feed.


    mikegarlick
    Participant

    @mikegarlick

    actually it shows up on the sitewide activity but not on the personal one. things wrong with it though is that there is no avatar, @username link and the $project_link doesnt show either


    mikegarlick
    Participant

    @mikegarlick

    This is adding to the database and the site wide activity but not to the personal activity feed

    `$project_link = ‘http://www.examplc.co.uk/member/’.$user_name.’/portfolio/view/?project=’.$project_id.”;
    $action = ‘@’.$user_name.’ has just added a new project ‘;
    $activity_content = ‘‘.$album_title.’‘;

    bp_activity_add ( array(
    ‘action’ => $action,
    ‘content’ => $activity_content,
    ‘primary_link’ => $project_link,
    ‘component’ => ‘activity’,
    ‘type’ => ‘activity_update’,
    ‘user_id’ => $bp->loggedin_user->id,
    ‘item_id’ => $bp->displayed_user->id
    )
    );`


    mikegarlick
    Participant

    @mikegarlick

    Fixed it. My own stupid fault for not including `global $bp;`.
    sorry for wasting your time.


    tchburn
    Participant

    @tchburn

    Would you mind sharing more information about how/where you used the code? I’m trying to get something similar working with a form submit and getting nowhere.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘bp_activity_add not working’ is closed to new replies.
Skip to toolbar