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) | 介绍了。 |