BuddyDev

Search

[Resolved] blog categories for groups | an issue of showing posts in activity stream

  • Participant
    Level: Initiated
    Posts: 13
    Mohamed Fahmy on #11280

    yes please , i need it very badly .. thanks a lot brajesh

  • Participant
    Level: Initiated
    Posts: 13
    Mohamed Fahmy on #11301

    Hey Brajesh .. i’m still waiting your guideline , i tried to figure it out the last days with no result .. any help will be highly appreciated
    thanks in advance

  • Keymaster
    (BuddyDev Team)
    Posts: 24593
    Brajesh Singh on #11313

    Hi Mohamed,
    here is the code that we use(similar to this)

    
    function buddydev_update_activity_args_on_publish( $args ) {
    
    	if ( $args['component'] !== 'blogs' || $args['type'] !== 'new_blog_post' ) {
    		// change type to yours.
    		return $args;
    	}
    	// It must be post publish. let us check for the post meta.
    	// check if this was saved via BCG.
    	$post_id  = $args['secondary_item_id'];
    	$group_id = get_post_meta( $post_id, '_bcg_group_id', true );
    
    	if ( ! $group_id ) {
    		return;
    	}
    
    	$args['component'] = 'groups';
    	$args['item_id']   = absint( $group_id );
    
    	return $args;
    }
    
    add_action( 'bp_after_activity_add_parse_args', 'buddydev_update_activity_args_on_publish' );
    
    

    You can change this

    
    
    $args['type'] !== 'new_blog_post'
    

    and replace ‘new_blog_post’ with your activity type.

    And it will work. You can put the above code in your bp-custom.php

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 13
    Mohamed Fahmy on #11325

    It works like a charm .. thanks a lot brajesh ,wish you all the best

  • Keymaster
    (BuddyDev Team)
    Posts: 24593
    Brajesh Singh on #11327

    Thank you. I am glad it worked.
    Marking as resolved.

    Regards
    Brajesh

The topic ‘ [Resolved] blog categories for groups | an issue of showing posts in activity stream’ is closed to new replies.

This topic is: resolved