bbp_admin_repair_topic_meta ()

重新获取每个帖子的主题

描述

返回

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

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

函数bbp_admin_repair_topic_meta(){全局$wpdb;$statement = __('重新计算每个帖子的讨论…% s”、“buddyboss”);$result = __('失败!”、“buddyboss”);//首先,删除所有内容。if (is_wp_error($wpdb->query("DELETE FROM ' $wpdb->postmeta ' WHERE ' meta_key ' = '_bbp_topic_id';")))返回数组(1,sprintf($statement, $result));//接下来,给所有的主题与答复的ID他们的最后答复。if (is_wp_error($wpdb->query("INSERT INTO ' $wpdb->postmeta ' (' post_id ', ' meta_key ', ' meta_value ') (SELECT ' topic ' . txt ') . txt ' . txt ' . txt ') . txt ' . txt ' . txt ')。“ID”,“_bbp_topic_id”、“主题”。`ID` 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_topic_id', `topic`.`ID` 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) 介绍了。

问题吗?

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