我正在使用wordpress中的wishlist。我需要在模板页面上显示特定级别的所有成员列表。任何人都可以帮助我如何列出所有成员。我写了这段代码。首先,我获得所有wordpress用户的列表,然后检查级别。
<?php
$wp_user_search = $wpdb->get_results("SELECT ID, display_name FROM $wpdb->users ORDER BY ID");
foreach ( $wp_user_search as $userid ) {
echo $user_id = (int) $userid->ID;
$user_login = stripslashes($userid->user_login);
$display_name = stripslashes($userid->display_name);
$return = '';
$return .= "\t" . '<li>'. $display_name .'</li>' . "\n";
$check = wlmapi_is_user_a_member(1340726008, $user_id);
if ( $check ) {
echo $user_id;
echo do_shortcode('[wlm_firstname]');
} else {
echo 'User is not a member';
}
}
?>