Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Custom Post Type Support for Activity

@monkey1980

Participant

Sorry!

Indeed, the New Post generates an activity item with ‘user wrote a new item’ – if a then change the CPT to ‘page’ but leave the action ID as my custom one the WordPress Admin and the Frontend both show my custom activity message! my code is below – the %3$s makes sense as I not running multi-site:

// Don't forget to add the 'buddypress-activity' support!
add_post_type_support( 'sd_article', 'buddypress-activity' );
 
function customize_page_tracking_args() {
    // Check if the Activity component is active before using it.
    if ( ! bp_is_active( 'activity' ) ) {
        return;
    }
 
    bp_activity_set_post_type_tracking_args( 'sd_article', array(
        'component_id'             => buddypress()->activity->id,
        'action_id'                => 'new_sd_article',
        'bp_activity_admin_filter' => __( 'Neuer Artikel veröffentlicht', 'custom-domain' ),
        'bp_activity_front_filter' => __( 'Artikel', 'custom-domain' ),
        'contexts'                 => array( 'activity', 'member' ),
        'bp_activity_new_post'     => __( '%1$s hat den neuen <a href="%2$s">Artikel</a>', 'sozialdynamik' ),
        'bp_activity_new_post_ms'  => __( '%1$s hat den neuen <a href="%2$s">Artikel</a>, on the site %3$s', 'sozialdynamik' ),
        'position'                 => 100,
    ) );
}
add_action( 'bp_init', 'customize_page_tracking_args' );

----->

I hope this is clearer!! :0)

Skip to toolbar