Skip to:
Content
Pages
Categories
Search
Top
Bottom

Trying to generate an activity id

  • @davidpaulalbert

    Member

    Been spinning my wheels on this for hours. Trying to generate an $activity_id var using the following:

    global $bp;
    $activity_id = bp_activity_get_activity_id( array(
    ‘user_id’ => $post->author_id,
    ‘type’ => ‘new_blog_post’,
    ‘component’ => ‘blogs’,
    ‘item_id’ => 1,
    ‘secondary_item_id’ => $post->ID

    I’m running this in the loop for posts. Essentially I’m trying to recreate a “favorite button” hack I read about here: http://www.dnxpert.com/2010/06/11/mark-blog-post-as-favorite-in-buddypress/ which if you read the comments, does seem to work for people running BP 1.5.5 w/ WP 3.3.

    The problem is I simply cannot get the $activity_id to generate. When I try to echo it out I get nothing…if anyone can shed some insight, I would appreciate it immensely.

Viewing 4 replies - 1 through 4 (of 4 total)
  • @davidpaulalbert

    Member

    Oh, and it doesn’t show, but I am closing out the array properly. Thanks.

    @chrisclayton

    Participant

    because of your use of `$post->ID`

    I think you might need to use…
    `global $bp, $post;`

    @djpaul

    Keymaster

    p.s. you won’t be generating a new activity ID with that function, but you’d be retrieving the existing activity that matches the argument.

    @davidpaulalbert

    Member

    Adding the global $post var makes no difference. Any other ideas? (Paul, thanks for the clarification–makes sense.)

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Trying to generate an activity id’ is closed to new replies.
Skip to toolbar