Skip to:
Content
Pages
Categories
Search
Top
Bottom

GROUP ACTIVITY HOOKS that would be great to have.


  • denisprogrammer
    Participant

    @denisprogrammer

    I am working on a social network custom project and I am missing group activity hooks.

    It would be great to have hooks like:

    – After_Group_Activity_Saved (providing saved $row_id)
    – After_Group_Activity_Deleted (providing deleted $row_id)

    At the moment I have this working but it is more a hack than a solution.
    I needed to write custom frontend listeners and then use recursive functions to check if row is added to the DB table… and so on.

    So as I said, it would be great to have those hooks and parameters.

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

  • denisprogrammer
    Participant

    @denisprogrammer

    Let me correct my self, I’ve found the hook that fires after the activity has been deleted and it returns row id.

    “bp_activity_action_delete_activity”


    denisprogrammer
    Participant

    @denisprogrammer

    I’ve tried all of these hooks an some of them are firing but none of them are providing activity_id (INT). ROW id.

    //Should fire after activity post saved/updated
    // do_action( ‘bp_activity_posted_update’, $content, $user_id, $activity_id );`
    // do_action( ‘bp_groups_posted_update’, $content, $user_id, $group_id, $activity_id );
    // do_action( ‘bp_activity_add’, $r, $activity->id );
    // do_action( ‘bp_activity_posted_update’, $r[‘content’], $r[‘user_id’], $activity_id );
    // do_action( ‘bp_activity_post_type_published’, $activity_id, $post, $activity_args );
    // do_action( ‘bp_activity_post_type_updated’, $post, $activity, $activity_post_object );


    denisprogrammer
    Participant

    @denisprogrammer

    This one also isn’t working:

    // define the bp_activity_after_save callback
    function action_bp_activity_after_save( $rtmedia_bp_activity_after_save_callback, $int_val1, $int_val2 ) {
        // make action magic happen here...
    };
    
    // add the action
    add_action( 'bp_activity_after_save', 'action_bp_activity_after_save', 10, 3 );

    denisprogrammer
    Participant

    @denisprogrammer

    Is there at least one hook that will provide row id on bp group activity after a post is saved?


    shanebp
    Moderator

    @shanebp

    This works as expected:

    function test_bp_activity_add( $r, $activity_id ) {
    
    	write_log( $activity_id  );
    	write_log( $r );
    
    }
    add_action( 'bp_activity_add', 'test_bp_activity_add', 99, 2 );
    //do_action( 'bp_activity_add', $r, $activity->id );

    From the log:

    [28-Nov-2019 12:56:39 UTC] 419
    [28-Nov-2019 12:56:39 UTC] Array
    (
        [id] => 
        [action] => 
        [content] => Test action hook on Group activity update
        [component] => groups
        [type] => activity_update
        [primary_link] => 
        [user_id] => 1
        [item_id] => 1
        [secondary_item_id] => 
        [recorded_time] => 2019-11-28 12:56:39
        [hide_sitewide] => 
        [is_spam] => 
        [error_type] => bool
    )

    So just set a conditional to check if $r['component'] == groups and do whatever you want.


    denisprogrammer
    Participant

    @denisprogrammer

    I see that hook “bp_activity_add” fires.
    But it doesn’t return [id] value in your log.
    Not returning row [id] is the issue.


    shanebp
    Moderator

    @shanebp

    The activity_id IS the row id, iow. the row id is 419
    [28-Nov-2019 12:56:39 UTC] 419

    All you have to do is try it yourself.


    denisprogrammer
    Participant

    @denisprogrammer

    I’ve tried and it is working as it suppose to.

    (I am not sure why it didn’t work at first but it is working now.)

    Thanks!

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