manual bp_activity_add within bp_activity_before_save
-
WordPress Version 4.1
BuddyPress Version Version 2.1.1I am trying to create a group activity feed everytime a new custom post type post is created.
add_action('bp_activity_before_save', 'rewards_activity_content', 3);
function rewards_activity_content($activity){ global $post; global $bp; //i have some working code here $bp->groups->current_group = groups_get_group( array( 'group_id' => $group_id ) ); $groups_activity_action = sprintf( __( '%1$s posted a reward %2$s in the group %3$s', 'buddypress'), bp_core_get_userlink( $user_id ),'<a href="' . $post_permalink . '">' . $post->post_title . '</a>' ,'<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . esc_attr( $bp->groups->current_group->name ) . '</a>' ); $groups_args = array( 'action' => apply_filters( 'groups_activity_new_update_action', $groups_activity_action ), 'content' => apply_filters( 'groups_activity_new_update_content', $activity_content ), 'component' => 'groups', 'type' => 'activity_update', 'primary_link' => $post_permalink, 'secondary_item_id' => $post_id, 'item_id' => $group_id, 'user_id' => $user_id, ); do_action( 'bp_activity_add', $groups_args ); //not working }
all of the values within the $group array is being populated its just the last do_action is not working. I also tried doing groups_record_activity.
I have also tried to pass through these arguements through a custom action to bp_activity_add and its still not working any help would be grateful.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘manual bp_activity_add within bp_activity_before_save’ is closed to new replies.