bp_update_activity_feed_of_post (美元的帖子,美元的请求,美元的行动)
在附加到特定帖子的附件之后更新帖子活动提要。
描述
参数
- 美元的帖子
-
(必需)
- 美元的请求
-
(必需)
- 美元的行动
-
(必需)
源
文件:bp-activity / bp-activity-functions.php
function bp_update_activity_feed_of_post($post, $request, $action){//检查WP_Post如果不是则返回if (!is_a($post, 'WP_Post')) {return;} $enabled = bp_is_post_type_feed_enable($post->post_type);//如果激活,则更新活动。if ($enabled){//获取post类型跟踪参数。$activity_post_object = bp_activity_get_post_type_tracking_args($post->post_type);If (empty($activity_post_object->action_id)){返回;} //获取基于post的现有活动id。$post->ID, 'type' => $activity_post_object->action_id,)); / /将item_id改为$activity_post_object->action_id// Activity ID不存在,所以停止! if ( empty( $activity_id ) ) { return; } // Delete the activity if the post was updated with a password. if ( ! empty( $post->post_password ) ) { bp_activity_delete( array( 'id' => $activity_id ) ); } // Update the activity entry. $activity = new BP_Activity_Activity( $activity_id ); // get the excerpt first of post. $excerpt = get_the_excerpt( $post->ID ); // if excert found then take content as a excerpt otherwise take the content as a post content. $content = ( $excerpt ) ?: $post->post_content; // If content not empty. if ( ! empty( $content ) ) { $activity_summary = bp_activity_create_summary( $content, (array) $activity ); // Backward compatibility filter for the blogs component. if ( 'blogs' == $activity_post_object->component_id ) { $activity->content = apply_filters( 'bp_update_activity_feed_of_custom_post_content', $activity_summary, $content, (array) $activity, $post->post_type ); } else { $activity->content = $activity_summary; } } else { $src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full', false ); $activity_summary = ''; if ( isset( $src[0] ) ) { $activity_summary = sprintf( ' ', esc_url( $src[0] ) ); } // Backward compatibility filter for the blogs component. if ( 'blogs' == $activity_post_object->component_id ) { $activity->content = apply_filters( 'bp_update_activity_feed_of_custom_post_content', $activity_summary, $post->post_content, (array) $activity, $post->post_type ); } else { $activity->content = $activity_summary; } } // Save the updated activity. $updated = $activity->save(); } }
更新日志
版本 | 描述 |
---|---|
BuddyBoss 1.0.0 | 介绍了。 |