bbp_admin_repair_forum_meta ()

为每个帖子恢复论坛

描述

返回

(数组)状态码和消息的数组

文件:bp-forums / admin / tools.php

函数bbp_admin_repair_forum_meta(){全局$wpdb;$statement = __('重新计算每个帖子的论坛…% s”、“buddyboss”);$result = __('失败!”、“buddyboss”);//首先,删除所有内容。if (is_wp_error($wpdb->query("DELETE FROM ' $wpdb->postmeta ' WHERE ' meta_key ' = '_bbp_forum_id';")))返回数组(1,sprintf($statement, $result));//接下来,给所有的主题与答复的ID他们的最后答复。如果(is_wp_error ($ wpdb - >查询(“插入”wpdb - > postmeta’(‘post_id’,‘meta_key’,‘meta_value’)(选择“论坛”。“ID”,“_bbp_forum_id”、“论坛”。`post_parent` FROM `$wpdb->posts` AS `forum` WHERE `forum`。' post_type ' = '论坛' GROUP BY '论坛'。“ID”);”) ) ) return array( 2, sprintf( $statement, $result ) ); // Next, give all the topics with replies the ID their last reply. if ( is_wp_error( $wpdb->query( "INSERT INTO `$wpdb->postmeta` (`post_id`, `meta_key`, `meta_value`) ( SELECT `topic`.`ID`, '_bbp_forum_id', `topic`.`post_parent` FROM `$wpdb->posts` AS `topic` WHERE `topic`.`post_type` = 'topic' GROUP BY `topic`.`ID` );" ) ) ) return array( 3, sprintf( $statement, $result ) ); // Next, give all the topics with replies the ID their last reply. if ( is_wp_error( $wpdb->query( "INSERT INTO `$wpdb->postmeta` (`post_id`, `meta_key`, `meta_value`) ( SELECT `reply`.`ID`, '_bbp_forum_id', `topic`.`post_parent` FROM `$wpdb->posts` AS `reply` INNER JOIN `$wpdb->posts` AS `topic` ON `reply`.`post_parent` = `topic`.`ID` WHERE `topic`.`post_type` = 'topic' AND `reply`.`post_type` = 'reply' GROUP BY `reply`.`ID` );" ) ) ) return array( 4, sprintf( $statement, $result ) ); // Complete results return array( 0, sprintf( $statement, __( 'Complete!', 'buddyboss' ) ) ); }

更新日志

更新日志
版本 描述
bbPress (r3876) 介绍了。

问题吗?

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