Error message (if activated):
Deprecated: WP_User_Query was called with a parameter or argument that is deprecated since version 5.9.0! who is deprecated. Use capability instead. in /customers/267483_35232/websites/customers.kisys.cc/betriebseinrichter-shop.kisys.cc/wp-includes/functions.php on line 5600
A small update seems to help – can you integrated it?
wp-content/plugins/woo-bulk-editor/classes/helper.php:46
Remove
— ‘who’ => ‘authors’)
and replace it with:
++ ‘role’ => ‘authors’)
and everything works again fine
Thank you!
]]>function rca_list_authors() {
$authors = wp_list_authors(array(
'orderby' => 'post_count',
'order' => 'DESC',
'number' => null,
'optioncount' => true,
'exclude_admin' => false,
'show_fullname' => true,
'hide_empty' => true,
'echo' => true,
'style' => 'list',
'html' => true
)
);
$list = '';
if($authors) :
$list .= '<div class="author-list">';
foreach($authors as $author) :
$list .= '<div class="author">';
$archive_url = get_author_posts_url($author->ID);
$archive_photo = get_avatar($author->ID, 120);
$list .= '<p>' . $archive_photo . '</p>';
$list .= get_wp_user_avatar($author->ID, '120');
$list .= '<a href="'. $archive_url . '">' . $author->display_name . '</a>';
$list .= '<p class="author-bio>' . get_user_meta($author->ID, 'description', true) . '</p>';
$list .= '<p class="author-archive"><a href="'. $archive_url . '" title="' . __('View all posts by ', 'pippin') . $author->display_name . '">' . __('View author\'s posts', 'pippin') . '</a></p>';
$list .= '<p>' . $author->optioncount . '</p>';
$list .= '</div>';
endforeach;
$list .= '</div>';
endif;
return $list;
}
add_shortcode('rca_authors', 'rca_list_authors');
]]>We have a store on vokomercer, there is also a responsive-lightbox plug-in, and in the latest updates, the plugin started to do a huge load on the bd, creating heavy queries.
file:/plugins/responsive-lightbox/includes/class-galleries.php:get_users
Could you, in the next release, change this method to use the native sql query, without using the wordpress function of get_users:
$users = get_users(
array(
‘fields’ => array( ‘ID’, ‘user_login’ )
)
);
With large data of wordpress, this code creates a large load on the database.
]]>In the Pennsylvania list, I need to add one of the people from the Washington DC list and only this one person.
This is what I have to fetch the content:
// Get all contributors, display in alphabetical order
$allUsers = get_users('role=contributor&orderby=user_lastname&order=ASC&exclude=1');
$fl_team = get_users('role=fl_team&orderby=user_lastname&order=ASC&exclude=');
$pa_team = get_users('role=pa_team&orderby=user_lastname&order=ASC&exclude=');
$dc_team = get_users('role=dc_team&orderby=user_lastname&order=ASC&exclude=');
$users = array();
$fl_teams = array();
$pa_teams = array();
$dc_teams = array();
Is there a way in get_users
to call one user from another list? I tried this, but it didn’t work:
$pa_team = get_users('role=pa_team&orderby=user_lastname&order=ASC&exclude=' || 'include=26');
I thought that including user id 26 would add them to the PA list. But instead it added all users to the list. Including admins.
I’ve looked all over Google, but I don’t think I’m asking the question properly. Any advice would be appreciated.
]]>add_action('init','starBoxCustom');
function starBoxCustom(){
if (!class_exists('ABH_Controllers_Frontend'))
return;
ABH_Classes_ObjController::getController('ABH_Controllers_Frontend')->custom = true;
}
function starBoxShow($user_id) {
if (!class_exists('ABH_Controllers_Frontend'))
return;
ABH_Classes_ObjController::getController('ABH_Classes_Tools');
$theme = ABH_Classes_Tools::getOption('abh_theme');
$str = '';
$str .= '<script type="text/javascript" src="' . _ABH_ALL_THEMES_URL_ . $theme . '/js/frontend.js?ver=' . ABH_VERSION . '"></script>';
$str .= '<link rel="stylesheet" href="' . _ABH_ALL_THEMES_URL_ . $theme . '/css/frontend.css?ver=' . ABH_VERSION . '" type="text/css" media="all" />';
$str .= ABH_Classes_ObjController::getController('ABH_Controllers_Frontend')->showBox($user_id);
return $str;
}
function contributors() {
$authors = array();
// roles you want to include
$roles = array('editor','author','contributor');
foreach ($roles as $role) {
$users_query = get_users(
array(
'fields' => array('ID', 'user_nicename'),
'orderby' => 'post_count',
'order' => 'DESC',
'role' => $role
)
);
if($users_query) {
$authors = array_merge($authors, $users_query);
}
}
if(!empty($authors)) {
foreach($authors as $author) {
echo starBoxShow( $author->ID );
echo "<br />";
}
}
}
and I’m calling the function in the page template with this:
<div id="authorlist"><ul><?php contributors(); ?></ul></div>
——————————————————–
ACF: team
Values: checkboxes of “development”, “planning”, “design”
——————————————————–
I would like to get_users with these keys.
For example, get_users for “development” team.
$args = array(
'meta_query' => array(
array(
'meta_key' => 'team',
'meta_value' > array('development'),
'meta_compare' => 'IN',
)
)
);
$users = get_users($args);
Unfortunately , this returns ALL users instead of those from the development team as stated in meta_query.
meta_compare => ‘LIKE’ or meta_compare => ‘=’ doesnt work either.
I tried to var_dump($users) and i found these are not retrieved through get_users.
I cant use get_user_meta as i want a list of users, and not the meta information for certain user.
Is there any way i can do this?
]]>I am using the below code to gather a list of authors that have NOT had a post (of any post types) published within the last 60 days.
<?php
$args = array(
'role' => 'contributor',
);
$blogusers = get_users( $args ); ?>
<div class="opinionators" class="cf">
<div class="title m-all t-all d-all">More than 60 days inactive</div>
<?php foreach ( $blogusers as $user ) {
//echo "<pre>"; print_r($user); echo "</pre>";
$argsone = array(
'date_query' => array(
//set date ranges with strings!
'after' => '60 days ago',
'before' => 'tomorrow',
//allow exact matches to be returned
'inclusive' => true,
),
'author' => $user->data->ID,
'posts_per_page' => -1,
'post_type' => 'any'
);
$twomonthposting = new WP_Query($argsone);
$twomonth_post_count = $twomonthposting->found_posts;
$argstwo = array(
'author' => $user->data->ID,
'posts_per_page' => -1,
'post_type' => 'any'
);
$postingsone = new WP_Query($argstwo);
$post_countone = $postingsone->found_posts;
if ($twomonth_post_count == 0 && $post_countone > 3) { ?>
DO STUFF
<?php } wp_reset_query(); } ?>
I once had 50 contributors and this worked – now that I have 122 contributors it breaks before the footer.
I wonder if someone wouldn’t mind scanning their expert eye over this code and seeing if I’m doing something wrong or missing something? FYI the webpage is Old Writers of Roobla.
Thank you for any help you can offer.
]]>The client has requested a custom order to the list of contributors. Not alpha-numeric like originally used. This is what I’ve done:
Installed the Advanced Custom Fields Plugin by Elliot Condon and created a field that is named “rank”. It is a dropdown list with the numbers 1-8. It is only assigned to users that equal “author” with no default value.
Then, I assigned each user the ranking they were requested. Lastly, in my template file I used the following code:
<?php
$allUsers = get_users('meta_key=rank&order=DESC');
$users = array();
// Remove subscribers from the list as they won't write any articles
foreach($allUsers as $currentUser)
{
if(!in_array( 'subscriber', $currentUser->roles ))
{
$users[] = $currentUser;
}
}
?>
On my local testing machine, this works perfectly. On the server I uploaded it to, I get a random listing which is being shown.
Any help would be appreciated. Thanks.
]]>