bbp_admin_repair_topic_voice_count ()
叙述主题成员
描述
返回
(数组)状态码和消息的数组
源
文件:bp-forums / admin / tools.php
函数bbp_admin_repair_topic_voice_count(){全局$wpdb;$statement = __('计算每次讨论的成员数量…% s”、“buddyboss”);$result = __('失败!”、“buddyboss”);$sql_delete = "DELETE FROM ' {$wpdb->postmeta} ' WHERE ' meta_key ' = '_bbp_voice_count';";If (is_wp_error($wpdb->query($sql_delete))) return array(1, sprintf($statement, $result));// Post类型和状态$tpt = bbp_get_topic_post_type();$ rpt = bbp_get_reply_post_type ();$ pps = bbp_get_public_status_id ();$ cps = bbp_get_closed_status_id (); $sql = "INSERT INTO `{$wpdb->postmeta}` (`post_id`, `meta_key`, `meta_value`) ( SELECT `postmeta`.`meta_value`, '_bbp_voice_count', COUNT(DISTINCT `post_author`) as `meta_value` FROM `{$wpdb->posts}` AS `posts` LEFT JOIN `{$wpdb->postmeta}` AS `postmeta` ON `posts`.`ID` = `postmeta`.`post_id` AND `postmeta`.`meta_key` = '_bbp_topic_id' WHERE `posts`.`post_type` IN ( '{$tpt}', '{$rpt}' ) AND `posts`.`post_status` IN ( '{$pps}', '{$cps}' ) AND `posts`.`post_author` != '0' GROUP BY `postmeta`.`meta_value`);"; if ( is_wp_error( $wpdb->query( $sql ) ) ) return array( 2, sprintf( $statement, $result ) ); return array( 0, sprintf( $statement, __( 'Complete!', 'buddyboss' ) ) ); }
更新日志
版本 | 描述 |
---|---|
bbPress (r2613) | 介绍了。 |