Exclude post categories, Personalize custom post type
-
Hello
I would exclude automatically, some categories of the blog post, in the activity stream. It’s possible?I saw that the same problem was seen here: https://buddypress.org/support/topic/possible-to-exclude-post-categories-in-activity-stream-and-make-a-user-profile-private-like-with-pri/
But applying the same function with the latest version of BuddyPress, it does not work. is possilibe?
I also tried to customize the Post Types default ‘post’, following this guide: https://codex.buddypress.org/plugindev/post-types-activities/
changing fields as well:
add_post_type_support( 'post', '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( 'post', array( 'component_id' => buddypress()->blogs->id, 'action_id' => 'new_blog_post', // or 'new_post' 'bp_activity_admin_filter' => __( 'Published a new post', 'emt-buddypress' ), 'bp_activity_front_filter' => __( 'Posts', 'emt-buddypress' ), 'contexts' => array( 'activity', 'member' ), 'activity_comment' => true, 'bp_activity_new_post' => __( '%1$s shared a new <a href="%2$s">post</a>', 'emt-textbuddypress' ), 'bp_activity_new_post_ms' => __( '%1$s sahred a new <a href="%2$s">post</a>, on the site %3$s', 'emt-textbuddypress' ), 'position' => 100, ) ); } add_action( 'bp_init', 'customize_page_tracking_args' );
Finally I tried to customize the content of the post, in activity stream, as always suggested in this post:
guide:https://codex.buddypress.org/plugindev/post-types-activities/
or this:
https://buddypress.org/support/topic/custom-activity-new-post-content-not-broken-after-update-the-post/This is my function:
function record_cpt_activity_content( $cpt ) { if ( 'new_post' === $cpt['type'] ) { $cpt['content'] = '<a href="' . get_permalink( $post->ID ) . '" class="activity-content-title" >' $post->ID). '</span><br />' . get_the_post_thumbnail( $post->ID, '') . '<br /> <br />' . get_post_field('post_content', $post->ID); } return $cpt; } add_filter('bp_before_activity_add_parse_args', 'record_cpt_activity_content');
The problem is that the added HTML
<a href="' . get_permalink( $post->ID ) . '" class="activity-content-title" >' $post->ID). '</span><br />
tags are not preserved when the post is published. Solutions?
Thanks for your attention and assistance
- You must be logged in to reply to this topic.