Skip to:
Content
Pages
Categories
Search
Top
Bottom

Add to group activity and send notification


  • amanavohra
    Participant

    @amanavohra

    Hi,

    I am trying to add to group activity stream and send a notification but its not working – Help pls
    Adding to group activity like this

    
    add_post_type_support( 'product', 'buddypress-activity' );
    
    function customize_page_tracking_args() {
    	// Check if the Activity component is active before using it.
    	if ( ! bp_is_active( 'activity' ) ) {
    		return;
    	}
    	
    	global $bp;
    	$gid = $bp->groups->current_group->id;
    	$group = new BP_Groups_Group($gid, true);
    	$user_id = get_current_user_id();
    	
    	
    	groups_record_activity( array(
    			'action'  => apply_filters( 'groups_activity_new_update_action', sprintf( __( '%1$s publicó una actualización en %2$s', 'buddypress'), bp_core_get_userlink( $user_id ), '<a href="' . bp_get_group_permalink( $group ) . '">' . esc_attr( bp_get_group_name( $group ) ) . '</a>' ) ),
    			'content'   => $content,
    			'type'    => $type,
    			'item_id' => $gid,
    			'user_id' => $user_id
    	)
    	);
    
    }
    add_action( 'save_post', 'customize_page_tracking_args', 1000 );
    

    Adding to notification like this

    
    bp_notifications_add_notification( array(
    		'user_id'           => $cid,
    		'item_id'           => $post_id,
    		
    ) );
    
  • The topic ‘Add to group activity and send notification’ is closed to new replies.
Skip to toolbar