Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to access the $activity Object before its saved to the Database


  • vijaychacko56
    Participant

    @vijaychacko56

    Hi,

    Whenever a user performs certain default actions, such as reply in a group forum, there is an entry in their activity stream showing that they had replied to so and so forum at so and so time. So what am looking for is this- when a user performs the action before the event is recorded in the activity stream, I would like to access the $activity object. Can someone please tell me where the save functionality is implemented for a new addition to the activity stream. For example, I know that in bp-activity-functions.php file in method bp_activity_add() function it has a line $save = $activity->save(); But I noticed that the code does not flow to this function when saving default actions. I also did not find any hook I can use to access $activity object before it is saved. Please help. Thank You

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

  • shanebp
    Moderator

    @shanebp

    afaik, you’re looking in the wrong place – easy to do.

    Look in the bbPress plugin:
    ...wp-content\plugins\bbpress\includes\extend\buddypress\activity.php

    And they have their own forums.


    vijaychacko56
    Participant

    @vijaychacko56

    Thank You @shanebp for your response. I will look at the specific file mentioned. My requirement is not just limited to the forum actions. I would like to know the function that is called to save an activity event into the activity stream. I thought it was bp_activity_add() but looks like all actions do not use this.


    shanebp
    Moderator

    @shanebp

    afaik, bp_activity_add() is the call always used in BuddyPress – there may be exceptions that you’ll have to track down.

    But other plugins, like bbPress, may use their own methods, or use bp_activity_add().

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