Php 在bbpress上突出在WooCommerce上购买产品的作者的主题

Php 在bbpress上突出在WooCommerce上购买产品的作者的主题,php,wordpress,woocommerce,bbpress,Php,Wordpress,Woocommerce,Bbpress,我正在使用bbpress进行论坛和商业活动。我想强调购买产品的作者的主题。这是我的代码,但它不起作用。我把它放在loop-single-topic.php中 <?php $id_product_list = array(); $loop = new WP_Query( array( 'post_type' => array('product', 'product_variation'), 'posts_per_page' => -1 ) )

我正在使用bbpress进行论坛和商业活动。我想强调购买产品的作者的主题。这是我的代码,但它不起作用。我把它放在loop-single-topic.php中

<?php   
        $id_product_list = array();
        $loop = new WP_Query( array( 'post_type' => array('product', 'product_variation'), 'posts_per_page' => -1 ) );
        while ( $loop->have_posts() ) : $loop->the_post();
        $theid = get_the_ID();
        array_push($id_product_list, $theid);
        endwhile; wp_reset_query(); 

        $user_email = get_the_author_meta('user_email'); 
        $author_id = get_the_author_meta('ID'); 

        foreach ($id_product_list as $key => $value){
        ?>
        <?php   if( wc_customer_bought_product( $user_email, $author_id, $value ) ) { ?>
        <span class='vip-memeber'><a class="bbp-topic-permalink" href="<?php bbp_topic_permalink(); ?>"><?php bbp_topic_title(); ?></a></span>
        <?php break; ?>
        <?php } ?>
        <?php else { ?>
        <a class="bbp-topic-permalink" href="<?php bbp_topic_permalink(); ?>"><?php bbp_topic_title(); ?></a>
        <?php } ?>

    <?php } ?>

我想听听你的想法

谢谢