bp_media_admin_repair_media()

修复伙计博士媒体。

描述

来源

文件:BP-Media / BP-Media-Filters.php

功能bp_media_admin_repair_media(){global $ wpdb;$ offset = isset($ _post ['offset'])?(int)($ _post ['offset']):0;$ bp = buddypress();$ media_query =“select id,fromation_id from {$ bp-> media-> table_name}其中active_id!= 0限制50偏移$ offset”;$ Media = $ wpdb-> get_results($ media_query);if(!空($媒体)){foreach($媒体为$媒体)- > activity_id);if(!空($活动 - > id))}如果(bp_is_active('groups')&& buddypress() - >组 - > id === $活动 - >组件){$ update_query =“更新{$ bp-> media-> table_name} set group_id =”。$活动 - > item_id。 ", privacy='grouponly' WHERE id=" . $media->id . " "; $wpdb->query( $update_query ); } if ( 'media' === $activity->privacy ) { if ( ! empty( $activity->secondary_item_id ) ) { $media_activity = new BP_Activity_Activity( $activity->secondary_item_id ); if ( ! empty( $media_activity->id ) ) { if ( 'activity_comment' === $media_activity->type ) { $media_activity = new BP_Activity_Activity( $media_activity->item_id ); } if ( bp_is_active( 'groups' ) && buddypress()->groups->id === $media_activity->component ) { $update_query = "UPDATE {$bp->media->table_name} SET group_id=" . $media_activity->item_id . ", privacy='grouponly' WHERE id=" . $media->id . " "; $wpdb->query( $update_query ); $activity->item_id = $media_activity->item_id; $activity->component = buddypress()->groups->id; } } } $activity->hide_sitewide = true; $activity->save(); } } } $offset ++; } $records_updated = sprintf( __( '%s media updated successfully.', 'buddyboss' ), number_format_i18n( $offset ) ); return array( 'status' => 'running', 'offset' => $offset, 'records' => $records_updated, ); } else { return array( 'status' => 1, 'message' => __( 'Media update complete!', 'buddyboss' ), ); } }

变更乐

变更乐
版本 描述
Buddyboss 1.4.4. 介绍。

问题?

我们总是很乐意帮助您可能拥有的代码或其他问题!搜索我们开发人员文档联系支持,或与我们联系销售团队