Skip to:

Buddypress actions and group activity stream

  • NickMackz


    I’m trying to put the activity stream of one of the groups on my site onto the homepage. I’m trying to adapt the code from activity.php in groups, single in the BuddyPress theme. The problem I’m having is that I don’t understand how the do_actions work to call functions. My understanding is that an action has to be declared using add_action that links it to a particular function. However, when I search all of the BuddyPress files for a name of an action, it only ever shows up in the theme files with do_action.

    I’m trying to find out how the actions link to functions so I can work out how to pass the functions the group ID so that they only show that group.

    Can anyone explain this for me because I am really stuck. I’ve done very very little PHP before but quite a lot of programming in other languages.

Viewing 1 replies (of 1 total)

  • shanebp


    Addressing just the do_action part of your question.

    add_action is used to call a particular function
    do_action is used to provide a hook to and specify when/where that function is called

    For example, in groups/single/activity.php, you should see this:


    So, in your theme functions.php, you could do this
    add_action( ‘bp_before_group_activity_content’, ‘my_function’);
    function my_function() {
    echo “

    my_function was called


    You should see “my_function was called” after the form and before the activity listings on all group activity pages – because that is where the do_action is located.

    You need to read up on do_action / add_action and apply_filters / add_filter.
    These concepts are essential to creating any WP code

Viewing 1 replies (of 1 total)
  • The topic ‘Buddypress actions and group activity stream’ is closed to new replies.
Skip to toolbar