Changeset 12544 for trunk/src/bp-blogs/bp-blogs-activity.php
- Timestamp:
- 01/29/2020 08:36:15 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-blogs/bp-blogs-activity.php
r12393 r12544 288 288 $blog_url = false; 289 289 290 // Try to get the blog url from the activity object 290 // Try to get the blog url from the activity object. 291 291 if ( isset( $activity->blog_url ) ) { 292 292 $blog_url = $activity->blog_url; … … 297 297 $blog_name = false; 298 298 299 // Try to get the blog name from the activity object 299 // Try to get the blog name from the activity object. 300 300 if ( isset( $activity->blog_name ) ) { 301 301 $blog_name = $activity->blog_name; … … 314 314 $post_url = false; 315 315 316 // Try to get the post url from the activity object 316 // Try to get the post url from the activity object. 317 317 if ( isset( $activity->post_url ) ) { 318 318 $post_url = $activity->post_url; … … 329 329 $post_title = false; 330 330 331 // Should be the case when the comment has just been published 331 // Should be the case when the comment has just been published. 332 332 if ( isset( $activity->post_title ) ) { 333 333 $post_title = $activity->post_title; 334 334 335 // If activity already exists try to get the post title from activity meta 335 // If activity already exists try to get the post title from activity meta. 336 336 } elseif ( ! empty( $activity->id ) ) { 337 337 $post_title = bp_activity_get_meta( $activity->id, 'post_title' ); … … 790 790 } 791 791 792 // Get associated post type and set default comment parent 792 // Get associated post type and set default comment parent. 793 793 $post_type = bp_activity_post_type_get_tracking_arg( $parent_activity->type, 'post_type' ); 794 794 $comment_parent = 0; … … 806 806 'comment_author_url' => bp_core_get_user_domain( $params['user_id'], $user->user_nicename, $user->user_login ), 807 807 'comment_content' => $params['content'], 808 'comment_type' => '', // Could be interesting to add ' buddypress' here...808 'comment_type' => '', // Could be interesting to add 'BuddyPress' here... 809 809 'comment_parent' => (int) $comment_parent, 810 810 'user_id' => $params['user_id'], … … 910 910 $activity_ids[] = $activity_id; 911 911 912 // Handle multisite 912 // Handle multisite. 913 913 // switch to the blog where the comment was made. 914 914 switch_to_blog( $parent_activity->item_id ); … … 924 924 BP_Activity_Activity::rebuild_activity_comment_tree( $parent_activity_id ); 925 925 926 // Avoid the error message although the comments were successfully deleted 926 // Avoid the error message although the comments were successfully deleted. 927 927 $deleted = true; 928 928 … … 947 947 } 948 948 949 // fetch parent activity item949 // Fetch parent activity item. 950 950 $parent_activity = new BP_Activity_Activity( $activity->item_id ); 951 951 952 // if parent activity isn't a post type having the buddypress-activity support for comments, stop now!952 // If parent activity isn't a post type having the buddypress-activity support for comments, stop now! 953 953 if ( ! bp_activity_type_supports( $parent_activity->type, 'post-type-comment-tracking' ) ) { 954 954 return; … … 972 972 switch_to_blog( $parent_activity->item_id ); 973 973 974 // Get the comment status 974 // Get the comment status. 975 975 $post_comment_status = wp_get_comment_status( $post_comment_id ); 976 976 $old_comment_status = $post_comment_status; 977 977 978 // No need to edit the activity, as it's the activity who's updating the comment 978 // No need to edit the activity, as it's the activity who's updating the comment. 979 979 remove_action( 'transition_comment_status', 'bp_activity_transition_post_type_comment_status', 10 ); 980 980 remove_action( 'bp_activity_post_type_comment', 'bp_blogs_comment_sync_activity_comment', 10 ); … … 996 996 } 997 997 998 // Restore actions 998 // Restore actions. 999 999 add_action( 'transition_comment_status', 'bp_activity_transition_post_type_comment_status', 10, 3 ); 1000 1000 add_action( 'bp_activity_post_type_comment', 'bp_blogs_comment_sync_activity_comment', 10, 4 ); … … 1055 1055 } 1056 1056 1057 // Get the associated post type 1057 // Get the associated post type. 1058 1058 $post_type = bp_activity_post_type_get_tracking_arg( $args['action'], 'post_type' ); 1059 1059 1060 // Bail if this is not an activity associated with a post type 1060 // Bail if this is not an activity associated with a post type. 1061 1061 if ( empty( $post_type ) ) { 1062 1062 return $args; 1063 1063 } 1064 1064 1065 // Bail if this is an activity about posts and not comments 1065 // Bail if this is an activity about posts and not comments. 1066 1066 if ( bp_activity_post_type_get_tracking_arg( $args['action'], 'comment_action_id' ) ) { 1067 1067 return $args; … … 1236 1236 // It's a post type supporting comment tracking. 1237 1237 if ( bp_activity_type_supports( $type, 'post-type-comment-tracking' ) ) { 1238 // The activity type is supporting comments or replies 1238 // The activity type is supporting comments or replies. 1239 1239 if ( bp_activity_type_supports( $type, 'post-type-comment-reply' ) ) { 1240 1240 // Setup some globals we'll need to reference later. … … 1251 1251 $retval = false; 1252 1252 } 1253 // The activity type does not support comments or replies 1253 // The activity type does not support comments or replies. 1254 1254 } else { 1255 1255 $retval = false; … … 1286 1286 } 1287 1287 1288 // Check the parent activity 1288 // Check the parent activity. 1289 1289 $parent_activity = new BP_Activity_Activity( bp_get_activity_item_id() ); 1290 1290 … … 1439 1439 $bp = buddypress(); 1440 1440 1441 // Check if a comment action id is set for the parent activity 1441 // Check if a comment action id is set for the parent activity. 1442 1442 $comment_action_id = bp_activity_post_type_get_tracking_arg( $parent_activity->type, 'comment_action_id' ); 1443 1443 1444 // Use the action string callback for the activity type 1444 // Use the action string callback for the activity type. 1445 1445 if ( ! empty( $comment_action_id ) ) { 1446 1446 // Fake a 'new_{post_type}_comment' by cloning the activity object. 1447 1447 $object = clone $activity; 1448 1448 1449 // Set the type of the activity to be a comment about a post type 1449 // Set the type of the activity to be a comment about a post type. 1450 1450 $object->type = $comment_action_id; 1451 1451 … … 1456 1456 $object->secondary_item_id = $blog_comment_id; 1457 1457 1458 // Get the format callback for this activity comment 1458 // Get the format callback for this activity comment. 1459 1459 $format_callback = bp_activity_post_type_get_tracking_arg( $comment_action_id, 'format_callback' ); 1460 1460 1461 // now format the activity action using the 'new_{post_type}_comment' action callback1461 // Now format the activity action using the 'new_{post_type}_comment' action callback. 1462 1462 if ( is_callable( $format_callback ) ) { 1463 1463 $retval = call_user_func_array( $format_callback, array( '', $object ) );
Note: See TracChangeset
for help on using the changeset viewer.