Last active
March 7, 2022 12:24
-
-
Save cristianstan/05d9dfe1bacf213e3eb686d5aa55fb19 to your computer and use it in GitHub Desktop.
WooCommerce WCFM Dokan: If vendor has publish auctions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// For iBid Auctions theme: https://themeforest.net/item/ibid-multi-vendor-auctions-woocommerce-theme/24923136 | |
function if_vendor_has_active_auctions($vendor_id){ | |
$args = array( | |
'post_type' => 'product', | |
'post_status' => 'publish', | |
'author' => $vendor_id, | |
'posts_per_page' => -1, | |
'tax_query' => array( | |
array( | |
'taxonomy' => 'product_type', | |
'field' => 'slug', | |
'terms' => 'auction' | |
), | |
), | |
); | |
$the_query = new WP_Query( $args ); | |
$count = $the_query->found_posts; | |
if ($count>0) { | |
return true; | |
} | |
} | |
if(is_user_logged_in()){ | |
if (get_current_user_id() == 25) { | |
$args = array( | |
'role' => '', | |
'meta_key' => '', | |
'meta_value' => '', | |
'meta_compare' => '', | |
'meta_query' => array(), | |
'date_query' => array(), | |
'include' => array(), | |
'exclude' => array(), | |
'orderby' => 'login', | |
'order' => 'ASC', | |
'has_published_posts' => array('product'), | |
'offset' => '', | |
'search' => '', | |
'number' => '', | |
'count_total' => false, | |
'fields' => 'all', | |
'who' => '' | |
); | |
$authors_title = array(); | |
$authors = get_users($args); | |
?> | |
<?php foreach ($authors as $user): ?> | |
<li> | |
<?php | |
if (if_vendor_has_active_auctions($user->data->ID)) { | |
echo $user->data->display_name; | |
} | |
?> | |
</li> | |
<?php endforeach; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment