bp_actity_post_type_update(wp_post | null.$帖子=空值的)
更新自定义帖子类型条目的活动项。
描述
参数
- $帖子
-
(WP_POST.|空值的)(可选的)邮寄项目。
默认值:null
返回
(null | wp_error | bool)成功的真实,失败的虚假。
来源
文件:BP-Activity / BP-Activity-函数.php
函数bp_actity_post_type_update($ post = null){if(!is_a($ post,'wp_post')){return;} //获取帖子类型跟踪args。$活动_post_object = bp_acticity_get_post_type_tracking_args($ post-> post_type);if(空($ activity_post_object-> action_id)){return;$活动= bp_actity_get_actity_id(array('component'=> $ activity_post_object-> component_id,'item_id'=> get_current_blog_id(),'secondard_item_id'=> $ post-> id,'type''=> $活动_post_object-> action_id,));//活动ID不存在,所以停止!if(空($ activity_id)){return;如果使用密码更新帖子,请删除该活动。if(!空($后> post_pastword)){bp_actity_delete(array('id'=> $ activity_id)); } // Update the activity entry. $activity = new BP_Activity_Activity( $activity_id ); if ( ! empty( $post->post_content ) ) { $activity_summary = bp_activity_create_summary( $post->post_content, (array) $activity ); // Backward compatibility filter for the blogs component. if ( 'blogs' == $activity_post_object->component_id ) { $activity->content = apply_filters( 'bp_blogs_record_activity_content', $activity_summary, $post->post_content, (array) $activity, $post->post_type ); } else { $activity->content = $activity_summary; } } // Save the updated activity. $updated = $activity->save(); /** * Fires after the updating of an activity item for a custom post type entry. * * @since BuddyPress 2.2.0 * @since BuddyPress 2.5.0 Add the post type tracking args parameter * * @param WP_Post $post Post object. * @param BP_Activity_Activity $activity Activity object. * @param object $activity_post_object The post type tracking args object. */ do_action( 'bp_activity_post_type_updated', $post, $activity, $activity_post_object ); return $updated; }
变更乐
版本 | 描述 |
---|---|
BuddyPress 2.2.0. | 介绍。 |