bp_document_admin_repair_document ()

修复BuddyBoss文档。

描述

文件:bp-document / bp-document-filters.php

函数bp_document_admin_repair_document(){全局$wpdb;$_POST = isset($_POST['offset']) ?(int) ($_POST['offset']): 0;英国石油美元= buddypress ();$document_query = "SELECT id, activity_id FROM {$bp->document->table_name} WHERE activity_id != 0 LIMIT 50 OFFSET $ OFFSET ";$documents = $wpdb->get_results($document_query);如果(!{foreach ($documents as $document) {if (!空($document->id) && !$activity = new BP_Activity_Activity($document->activity_id); if ( ! empty( $activity->id ) ) { if ( 'activity_comment' === $activity->type ) { $activity = new BP_Activity_Activity( $activity->item_id ); } if ( bp_is_active( 'groups' ) && buddypress()->groups->id === $activity->component ) { $update_query = "UPDATE {$bp->document->table_name} SET group_id=" . $activity->item_id . ", privacy='grouponly' WHERE id=" . $document->id . " "; $wpdb->query( $update_query ); } if ( 'document' === $activity->privacy ) { if ( ! empty( $activity->secondary_item_id ) ) { $document_activity = new BP_Activity_Activity( $activity->secondary_item_id ); if ( ! empty( $document_activity->id ) ) { if ( 'activity_comment' === $document_activity->type ) { $document_activity = new BP_Activity_Activity( $document_activity->item_id ); } if ( bp_is_active( 'groups' ) && buddypress()->groups->id === $document_activity->component ) { $update_query = "UPDATE {$bp->document->table_name} SET group_id=" . $document_activity->item_id . ", privacy='grouponly' WHERE id=" . $document->id . " "; $wpdb->query( $update_query ); $activity->item_id = $document_activity->item_id; $activity->component = buddypress()->groups->id; } } } $activity->hide_sitewide = true; $activity->save(); } } } $offset ++; } $records_updated = sprintf( __( '%s document updated successfully.', 'buddyboss' ), number_format_i18n( $offset ) ); return array( 'status' => 'running', 'offset' => $offset, 'records' => $records_updated, ); } else { return array( 'status' => 1, 'message' => __( 'document update complete!', 'buddyboss' ), ); } }

更新日志

更新日志
版本 描述
BuddyBoss 1.4.4 介绍了。

问题吗?

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