Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to get the activity ID and using it in hook?


  • wzshop
    Participant

    @wzshop

    Hi,
    So i want to write some extra data into the DB when someone is posting a activity update.
    I am not quite sure though what hook to use. I tried: bp_activity_posted_update AND bp_activity_add

    Anyway, i am going to need the activity ID when writing data into the DB. So, how do i get the activity ID in a custom function and using when someone is posting an activity update.

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)

  • wzshop
    Participant

    @wzshop

    This function helped me thanks:

    function bp_plugin_hook_activity_posted_update( $content, $user_id, $activity_id ) {
        // this is a silly example : just to illustrate !!
        $activity_count = get_user_meta( $user_id, 'silly_activity_counter' );
     
        $activity_count = empty( $activity_count ) ? 1 : intval( $activity_count ) + 1 ;
     
        update_user_meta( $user_id, 'silly_activity_counter', $activity_count );
     
    }
     
    add_action( 'bp_activity_posted_update', 'bp_plugin_hook_activity_posted_update', 10, 3 );

    rajeshthakur
    Participant

    @rajeshthakur

    @wzshop Thanks for answer..

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar