Changeset 13343
- Timestamp:
- 10/23/2022 02:21:19 AM (2 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-blogs/bp-blogs-functions.php
r13236 r13343 351 351 function bp_blogs_record_blog( $blog_id, $user_id, $no_activity = false ) { 352 352 353 if ( empty( $user_id ) ) 353 if ( empty( $user_id ) ) { 354 354 $user_id = bp_loggedin_user_id(); 355 } 355 356 356 357 // If blog is not recordable, do not record the activity. 357 if ( ! bp_blogs_is_blog_recordable( $blog_id, $user_id ) )358 if ( ! bp_blogs_is_blog_recordable( $blog_id, $user_id ) ) { 358 359 return false; 360 } 359 361 360 362 $name = get_blog_option( $blog_id, 'blogname' ); … … 382 384 $recorded_blog->blog_id = $blog_id; 383 385 $recorded_blog_id = $recorded_blog->save(); 384 $is_recorded = ! empty( $recorded_blog_id ) ? true : false;386 $is_recorded = ! empty( $recorded_blog_id ) ? true : false; 385 387 386 388 bp_blogs_update_blogmeta( $recorded_blog->blog_id, 'url', $url ); … … 393 395 bp_blogs_update_blogmeta( $recorded_blog->blog_id, 'comment_moderation', $moderation ); 394 396 395 $is_private = !empty( $_POST['blog_public'] ) && (int) $_POST['blog_public'] ? false : true;396 397 397 /** 398 398 * Filters whether or not a new blog is public. … … 402 402 * @param bool $is_private Whether or not blog is public. 403 403 */ 404 $is_private = !apply_filters( 'bp_is_new_blog_public', !$is_private ); 404 $is_private = ! apply_filters( 405 'bp_is_new_blog_public', 406 (bool) get_blog_option( $blog_id, 'blog_public' ) 407 ); 405 408 406 409 /** -
trunk/tests/phpunit/testcases/activity/functions.php
r13146 r13343 856 856 } 857 857 858 $b = self::factory()->blog->create(); 859 $u = self::factory()->user->create(); 858 $bp = buddypress(); 859 $b = self::factory()->blog->create(); 860 $u = self::factory()->user->create(); 861 $reset = $bp->activity->track; 860 862 861 863 switch_to_blog( $b ); 864 865 $bp->activity->track = array(); 862 866 863 867 register_post_type( 'foo', array( … … 884 888 885 889 _unregister_post_type( 'foo' ); 886 bp_activity_get_actions();887 888 890 restore_current_blog(); 889 891 890 $a = self::factory()->activity->create( $activity_args ); 891 892 $a = self::factory()->activity->create( $activity_args ); 892 893 $a_obj = new BP_Activity_Activity( $a ); 893 894 … … 899 900 900 901 $expected = sprintf( '%s wrote a new %s, on the site %s', $user_link, $post_link, '<a href="' . $blog_url . '">' . get_blog_option( $a_obj->item_id, 'blogname' ) . '</a>' ); 902 $bp->activity->track = $reset; 901 903 902 904 $this->assertSame( $expected, $a_obj->action ); … … 968 970 } 969 971 970 $b = self::factory()->blog->create(); 971 $u = self::factory()->user->create(); 972 $bp = buddypress(); 973 $b = self::factory()->blog->create(); 974 $u = self::factory()->user->create(); 975 $reset = $bp->activity->track; 972 976 973 977 switch_to_blog( $b ); 978 979 $bp->activity->track = array(); 974 980 975 981 $labels = array( … … 1010 1016 1011 1017 $user_link = bp_core_get_userlink( $u ); 1012 $blog_url = get_blog_option( $a_obj->item_id, 'home' );1013 $post_url = add_query_arg( 'p', $p, trailingslashit( $blog_url ) );1018 $blog_url = get_blog_option( $a_obj->item_id, 'home' ); 1019 $post_url = add_query_arg( 'p', $p, trailingslashit( $blog_url ) ); 1014 1020 1015 1021 $expected = sprintf( '%1$s shared a new <a href="%2$s">bar</a>, on the site %3$s', $user_link, $post_url, '<a href="' . $blog_url . '">' . get_blog_option( $a_obj->item_id, 'blogname' ) . '</a>' ); 1022 $bp->activity->track = $reset; 1016 1023 1017 1024 $this->assertSame( $expected, $a_obj->action ); … … 1098 1105 */ 1099 1106 public function test_bp_activity_format_activity_action_custom_post_type_comment() { 1107 $bp = buddypress(); 1108 $reset = $bp->activity->track; 1109 1100 1110 if ( is_multisite() ) { 1101 1111 $b = self::factory()->blog->create(); 1112 1102 1113 switch_to_blog( $b ); 1114 1115 $bp->activity->track = array(); 1103 1116 add_filter( 'comment_flood_filter', '__return_false' ); 1104 1117 } else { … … 1160 1173 1161 1174 $expected = sprintf( $labels['bp_activity_new_comment_ms'], $user_link, $comment_url, '<a href="' . $blog_url . '">' . get_blog_option( $a_obj->item_id, 'blogname' ) . '</a>' ); 1175 1176 $bp->activity->track = $reset; 1162 1177 } else { 1163 1178 $expected = sprintf( $labels['bp_activity_new_comment'], $user_link, $comment_url ); -
trunk/tests/phpunit/testcases/blogs/functions.php
r12606 r13343 886 886 */ 887 887 public function test_bp_blogs_comment_sync_activity_comment_for_custom_post_type() { 888 $bp = buddypress(); 889 $reset = $bp->activity->track; 890 888 891 if ( is_multisite() ) { 889 892 $b = self::factory()->blog->create(); 893 890 894 switch_to_blog( $b ); 895 896 $bp->activity->track = array(); 891 897 add_filter( 'comment_flood_filter', '__return_false' ); 892 898 } else { … … 971 977 if ( is_multisite() ) { 972 978 restore_current_blog(); 979 980 $bp->activity->track = $reset; 973 981 remove_filter( 'comment_flood_filter', '__return_false' ); 974 982 }
Note: See TracChangeset
for help on using the changeset viewer.