Changeset 9194 for trunk/src/bp-blogs/bp-blogs-filters.php
- Timestamp:
- 11/27/2014 05:13:29 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-blogs/bp-blogs-filters.php
r8945 r9194 43 43 * @since BuddyPress (2.1.0) 44 44 * 45 * @see bp_blogs_update_post ()45 * @see bp_blogs_update_post_activity_meta() 46 46 * 47 47 * @param array Current SQL clauses in array format … … 50 50 function bp_blogs_comments_clauses_select_by_id( $retval ) { 51 51 $retval['fields'] = 'comment_ID'; 52 52 53 53 return $retval; 54 54 } 55 56 /** 57 * Check whether the current post can be published. 58 * 59 * Abstracted from the deprecated `bp_blogs_record_post()`. 60 * 61 * @since BuddyPress (2.2.0) 62 * 63 * @param bool $return Whether the post should be published. 64 * @param int $blog_id ID of the blog. 65 * @param int $post_id ID of the post. 66 * @param int $user_id ID of the post author. 67 * @return bool True to authorize the post to be published, otherwise false. 68 */ 69 function bp_blogs_post_pre_publish( $return = true, $blog_id = 0, $post_id = 0, $user_id = 0 ) { 70 $bp = buddypress(); 71 72 // If blog is not trackable, do not record the activity. 73 if ( ! bp_blogs_is_blog_trackable( $blog_id, $user_id ) ) { 74 return false; 75 } 76 77 /* 78 * Stop infinite loops with WordPress MU Sitewide Tags. 79 * That plugin changed the way its settings were stored at some point. Thus the dual check. 80 */ 81 if ( ! empty( $bp->site_options['sitewide_tags_blog'] ) ) { 82 $st_options = maybe_unserialize( $bp->site_options['sitewide_tags_blog'] ); 83 $tags_blog_id = isset( $st_options['tags_blog_id'] ) ? $st_options['tags_blog_id'] : 0; 84 } else { 85 $tags_blog_id = isset( $bp->site_options['tags_blog_id'] ) ? $bp->site_options['tags_blog_id'] : 0; 86 } 87 88 if ( (int) $blog_id == $tags_blog_id && apply_filters( 'bp_blogs_block_sitewide_tags_activity', true ) ) { 89 return false; 90 } 91 92 $is_blog_public = apply_filters( 'bp_is_blog_public', (int) get_blog_option( $blog_id, 'blog_public' ) ); 93 94 if ( 0 === $is_blog_public && is_multisite() ) { 95 return false; 96 } 97 98 return $return; 99 } 100 add_filter( 'bp_activity_post_pre_publish', 'bp_blogs_post_pre_publish', 10, 4 );
Note: See TracChangeset
for help on using the changeset viewer.