BP_组_模板::_构造(大堆$args=数组())

构造函数方法。

描述

另见

参数

$args

(大堆)(可选)参数数组。接受由接受的所有参数BP_组_组::get()。如果参数的默认值不同,则将在下面讨论。

  • “每页”
    (国际)默认值:20。
  • “页面”
    (国际)默认值:1。

默认值:array()

来源

文件:bp-groups/classes/class-bp-groups-template.php

函数uu构造($args=array()){//与传递参数的旧方法的向后兼容性。如果(!is_数组($args)| | func_num_args()>1){不推荐的u参数(uu方法uu,'1.7',sprintf(uu,'传递给%1$s的参数应在关联数组中。有关详细信息,请参阅%2$s处的内联文档。','buddyboss),uuu方法uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu文件uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuukeys=array(0=>'user id',1=>'type',2=>'page',3=>'per_uuuupage',4=>'max',5=>'slug=>'slug',slug',7=>'popu populates'>'extrass',pute_uuuuuuuuuuuuuuuuuuuuuuu('page'=>1,'per\u page'=>20,'page\u arg'=>grpage','max'=>false,'type'=>active','order'=>DESC','orderby'=>date\u created','show\u hidden'=>false,'user\u id'=>0,'slug'=>false',include'=>false',parent\u id'=>null',search\u terms'=>array()“,”组类型“=>”,”组类型“=>”,”组类型“=>”,”元查询“=>”假“,”更新元缓存“=>真“,”更新管理缓存“=>假“;$r=bp解析参数($args,$defaults,$groups\u模板”);提取($r)$this->pag\u arg=sanitize\u键($r['page\u arg'])$this pag页面=bp\u sanitize\pagu pagu pagu['page'];$this->pag_num=bp_sanitize_pagination_arg('num',$r['per_page']);if(bp_current_user_can('bp_medium')|(is_user_loggeu in()&$user_id==bp_loggedin_user_id()){$show_hidden=true;}如果('invests'=$type){$this->groups=groups=groups=groups\u为_用户id($pagu exclude),则,$paguelseif('single group'=$type){$this->single_group=true;if(groups_get_current_group()){$group=groups_get_current_group();}else{$group=groups_get_group(BP_groups_group::get_id_from_slug($r['slug'))}//向后兼容性-“group\u id”变量不是//BP\u Groups\u group对象的一部分,但我们在此处添加它,以供开发人员对其进行检查////@seehttps://buddypress.trac.wordpress.org/changeset/3540 ////这可能会在将来的版本中删除;开发人员应该检查//$group->id而不是。$group->group\U id=$group->id;$this->groups=array($group);}否则{$this->groups=groups\u get\u groups(array)('type'=>$type,'order'=>$order,'orderby'=>$orderby,'per\u page'=>$this->pag\u num,'page'=>$this->pag\u page,'user\u id'=>$user\u id,'search\u terms'=>$search\u columns'=>$search\u columns,'meta\u query'=>$meta\u query,'group\u type'=>$group\u-type'=>$group\u-in'=>$group\u-in'>$group\u-in'>$group\u-type\u-in'=>,'include'=>$include',exclude'=>$exclude',parent\u id'=>$parent\u id',update\u meta\u cache'=>$update\u admin\u cache'=>$update\u admin\u cache',show\u hidden'=>$show\u hidden,);}如果('invests'==$type){$this->total\u group\u count int=$this->groups['total';$this->group\u count$this->groups=$this->groups['groups'];}elseif('single group'=$type){if(empty($group->id)){$this->total_group_count=0;$this->groups_count=0;}else{$this->total_group_count 1;$this->groups_count 1;}else{if(empty($max)| | max>=(int)$this->groups['total']){$this->['total'];}else{$this->total_group_count=(int)$max;}$this->groups=$this->groups['groups'];if(!empty($max)){$if($max>=count($this->groups)){$this->group_count count($this->groups);}}else{$this->groups->groups->count count count count count count($this->groups)}建立分页链接。if((int)$this->total_group_count&&(int)$this->pag_num{$pag_args=array($this->pag_arg=>'%\%');if(defined('DOING_AJAX')和&true==(bool)DOING_AJAX){$base=remove_query arg('s',wp_get_referer())->否则{$base=''>$add args=array('num this'=>$pag_num,'sortby'=>,按此顺序排序,$if->空($search\u terms){$query\u arg=bp\u core\u get\u component\u search\u query\u arg('groups');$add\u args[$query\u arg]=urlencode($search\u terms);}$this->pag\u links=paginate\u links(数组('base'=>add\u query\u arg($pag\u args,$base),'format'=>,'total'=>ceil($this->总组计数/(int)$this pag\u num),“当前”=>$this->pag_页面,'prev_text'=>$uuuuu('←','buddyboss'),'next_text'=>$uuu('→','buddyboss'),'mid_size'=>1,'add_args'=>$add_args,);}

问题?

我们随时乐意为您提供代码或其他问题的帮助!搜索我们的开发者文档,联系支持,或与我们的销售团队.