WP_Users_List_Table::获取视图():字符串[]

返回一个关联数组,其中列出了可用于此表的所有视图。

描述

提供角色列表和该角色的用户计数,以便轻松筛选用户表。

返回

字符串[]由视图键入的HTML链接数组。

来源

受保护的函数get_views(){全球$角色;$wp_roles=wp_roles();$count_users=!wp_is_large_user_count();if($this->issiteusers){$url='site-users.php?id=“$此->站点id;}其他{$url='users.php';}$role_links=数组();$avail_roles=数组();$all_text=__(“全部”);if($count_users){if($this->issiteusers){switch_to_blog($this->site_id);$users_of_blog=count_users('time',$this->site_id);恢复当前日志();}其他{$users_of_blog=计数用户();}$total_users=$users_of_blog['total_users'];$avail_roles=&$users_of_blog['可用角色'];取消设置($users_of_blog);$all_text=冲刺(/*翻译器:%s:用户数*/_nx(纳克斯)('所有<span class=“count”>(%s)</span>','所有<span class=“count”>(%s)</span>',$total_users,'用户'),number_format_i18n(总计$个用户));}$role_links['all']=数组(“url”=>$url,“label”=>$all_text,“当前”=>空($role),);foreach($wp_roles->get_names()作为$this_role=>$name){if($count_users&&!isset($avail_roles[$this_role]){继续;}$name=translate_user_role($name);if($count_users){$name=冲刺(/*转换器:1:用户角色名称,2:用户数*/__(“%1$s(%2$s)”),$名称,number_format_i18n($avail_roles[$this_role]));}$role_links[$this_role]=数组(“url”=>esc_url(add_query_arg(“角色”,$this_role,$url)),“label”=>$name,“当前”=>$this_role===$role,);}if(!空($avail_roles['none']){$name=__(“无角色”);$name=冲刺(/*转换器:1:用户角色名称,2:用户数*/__(“%1$s(%2$s)”),$名称,number_format_i18n($可用角色[“一个”]));$role_links['none']=数组(“url”=>esc_url(add_query_arg(“角色”,“无”,$url)),“label”=>$name,“当前”=>“无”===$role,);}返回$this->get_views_links($role_links);}

变更日志

版本描述
3.1.0介绍。

用户贡献的笔记

你必须登录在能够贡献笔记或反馈之前。