diff --git src/bp-blogs/bp-blogs-functions.php src/bp-blogs/bp-blogs-functions.php
index a608107..c5383f5 100644
|
|
|
function bp_blogs_record_blog( $blog_id, $user_id, $no_activity = false ) { |
| 279 | 279 | $is_private = !empty( $_POST['blog_public'] ) && (int) $_POST['blog_public'] ? false : true; |
| 280 | 280 | $is_private = !apply_filters( 'bp_is_new_blog_public', !$is_private ); |
| 281 | 281 | |
| 282 | | // Only record this activity if the blog is public. |
| 283 | | if ( !$is_private && !$no_activity && bp_blogs_is_blog_trackable( $blog_id, $user_id ) ) { |
| | 282 | // Only record this activity if the activity component is active and the blog is public. |
| | 283 | if ( bp_is_active( 'activity' ) && !$is_private && !$no_activity && bp_blogs_is_blog_trackable( $blog_id, $user_id ) ) { |
| 284 | 284 | |
| 285 | 285 | // Record this in activity streams. |
| 286 | 286 | bp_blogs_record_activity( array( |
| … |
… |
function bp_blogs_remove_blog( $blog_id ) { |
| 815 | 815 | |
| 816 | 816 | BP_Blogs_Blog::delete_blog_for_all( $blog_id ); |
| 817 | 817 | |
| 818 | | // Delete activity stream item. |
| 819 | | bp_blogs_delete_activity( array( |
| 820 | | 'item_id' => $blog_id, |
| 821 | | 'component' => buddypress()->blogs->id, |
| 822 | | 'type' => 'new_blog' |
| 823 | | ) ); |
| | 818 | /** |
| | 819 | * Delete activity stream item only if the Activity component is active |
| | 820 | * |
| | 821 | * @see https://buddypress.trac.wordpress.org/ticket/6937 |
| | 822 | */ |
| | 823 | if ( bp_is_active( 'activity' ) ) { |
| | 824 | bp_blogs_delete_activity( array( |
| | 825 | 'item_id' => $blog_id, |
| | 826 | 'component' => buddypress()->blogs->id, |
| | 827 | 'type' => 'new_blog' |
| | 828 | ) ); |
| | 829 | } |
| 824 | 830 | |
| 825 | 831 | /** |
| 826 | 832 | * Fires after a "blog created" item has been removed from blogs |
| … |
… |
function bp_blogs_remove_blog_for_user( $user_id, $blog_id ) { |
| 857 | 863 | |
| 858 | 864 | BP_Blogs_Blog::delete_blog_for_user( $blog_id, $user_id ); |
| 859 | 865 | |
| 860 | | // Delete activity stream item. |
| 861 | | bp_blogs_delete_activity( array( |
| 862 | | 'item_id' => $blog_id, |
| 863 | | 'component' => buddypress()->blogs->id, |
| 864 | | 'type' => 'new_blog' |
| 865 | | ) ); |
| | 866 | /** |
| | 867 | * Delete activity stream item only if the Activity component is active |
| | 868 | * |
| | 869 | * @see https://buddypress.trac.wordpress.org/ticket/6937 |
| | 870 | */ |
| | 871 | if ( bp_is_active( 'activity' ) ) { |
| | 872 | bp_blogs_delete_activity( array( |
| | 873 | 'item_id' => $blog_id, |
| | 874 | 'component' => buddypress()->blogs->id, |
| | 875 | 'type' => 'new_blog' |
| | 876 | ) ); |
| | 877 | } |
| 866 | 878 | |
| 867 | 879 | /** |
| 868 | 880 | * Fires after a blog has been removed from the tracker for a specific user. |
| … |
… |
function bp_blogs_remove_post( $post_id, $blog_id = 0, $user_id = 0 ) { |
| 910 | 922 | */ |
| 911 | 923 | do_action( 'bp_blogs_before_remove_post', $blog_id, $post_id, $user_id ); |
| 912 | 924 | |
| 913 | | // Delete activity stream item. |
| 914 | | bp_blogs_delete_activity( array( |
| 915 | | 'item_id' => $blog_id, |
| 916 | | 'secondary_item_id' => $post_id, |
| 917 | | 'component' => buddypress()->blogs->id, |
| 918 | | 'type' => 'new_blog_post' |
| 919 | | ) ); |
| | 925 | /** |
| | 926 | * Delete activity stream item only if the Activity component is active |
| | 927 | * |
| | 928 | * @see https://buddypress.trac.wordpress.org/ticket/6937 |
| | 929 | */ |
| | 930 | if ( bp_is_active( 'activity' ) ) { |
| | 931 | bp_blogs_delete_activity( array( |
| | 932 | 'item_id' => $blog_id, |
| | 933 | 'secondary_item_id' => $post_id, |
| | 934 | 'component' => buddypress()->blogs->id, |
| | 935 | 'type' => 'new_blog_post' |
| | 936 | ) ); |
| | 937 | } |
| 920 | 938 | |
| 921 | 939 | /** |
| 922 | 940 | * Fires after removal of a blog post activity item from the activity stream. |
| … |
… |
function bp_blogs_remove_data_for_blog( $blog_id ) { |
| 1108 | 1126 | // If this is regular blog, delete all data for that blog. |
| 1109 | 1127 | BP_Blogs_Blog::delete_blog_for_all( $blog_id ); |
| 1110 | 1128 | |
| 1111 | | // Delete activity stream item. |
| 1112 | | bp_blogs_delete_activity( array( |
| 1113 | | 'item_id' => $blog_id, |
| 1114 | | 'component' => buddypress()->blogs->id, |
| 1115 | | 'type' => false |
| 1116 | | ) ); |
| | 1129 | /** |
| | 1130 | * Delete activity stream item only if the Activity component is active |
| | 1131 | * |
| | 1132 | * @see https://buddypress.trac.wordpress.org/ticket/6937 |
| | 1133 | */ |
| | 1134 | if ( bp_is_active( 'activity' ) ) { |
| | 1135 | bp_blogs_delete_activity( array( |
| | 1136 | 'item_id' => $blog_id, |
| | 1137 | 'component' => buddypress()->blogs->id, |
| | 1138 | 'type' => false |
| | 1139 | ) ); |
| | 1140 | } |
| 1117 | 1141 | |
| 1118 | 1142 | /** |
| 1119 | 1143 | * Fires after all data related to a given blog has been removed from blogs tracker |