bp_nouveau_ajax_get_user_message_threads ()
AJAX获得所有用户消息线程。
描述
源
文件:bp-templates / bp-nouveau包括/信息/ ajax.php
函数bp_nouveau ajax_get_user_messages_threads(){global$messages_template;if(空($_POST['nonce']))|!wp_verify_nonce($_POST['nonce'],'bp_nouveau messages'){wp_send_json_error(数组('feedback'=>.'Unauthorized request','buddyboss','type'=>'error'))}$bp=buddypress()$reset_action=$bp->current_action;//重写bp_current_action().if(设置($_POST['box']){$bp->current_action=$_POST['box']}//添加消息线程筛选器。if('starred'==$bp->current_action){添加筛选器('bp_在有消息线程之后解析_args','bp_消息线程}}//模拟循环。如果(!bp_有消息线程(bp_ajax_querystring('messages')){//删除bp_当前操作()覆盖。$bp->current_action=$reset_action;wp_send_json_error(数组('feedback'=>。'buddyboss','type'=>'info'));//删除消息线程筛选器。如果('starred'==$bp->current_action){删除_filter('bp_has_message_threads_parse_args','bp_messages_filter_starred_message_threads'==bp->current_action)}$threads=new stdClass;$threads->meta=array('total_page'=>ceil((int)$messages_模板->总线程计数/(int)$messages模板->pag数量),'page'=>messages模板->pag页面,)$threads->threads=array();$i=0;while(bp_message_threads()):bp_message_thread();$last_message_id=(int)$messages_模板->thread->last_message_id;$threads->threads[$i]=array('id'=>bp_get_message_thread_id(),'message_id'=>(int)$last_message_id,'subject'=>strip_标签(bp_get_message thread_主题()),“摘录”=>strip_标记(bp_-get_-message_-thread_-extract()),“内容”=>do_短码(bp_-get_-message_-thread_-content()),“未读”=>bp_-message_-thread_-has_-unread(),“发件人名称”=>bp_-core_-get_-user_-user_-displayname($messages模板->线程->最后一个发件人id==bp_-id),“发送者链接”=>bp核心获取用户链接($messages\u template->thread->last\u sender\u id,false,true),“发送者化身”=>esc\u url(bp核心获取化身(数组('item\u id'=>messages\u template->thread->last\u sender\u id,'object'=>'user',type'=>'thumb',width'=>bp\u avatar\u thumb高度,'html'=>false))),“count”=>bp\u get\u message\u thread\u total\u count(),“date”=>strottime(bp\u get\u message\u thread\u last\u post\u date\u raw())*1000,“display\u date”=>bp\u nouveau\u get\u message\u message\u date(bp\u get\u message\u thread\u last\u post\u date\u raw()),“started\u date”=>date(get\u选项('date格式'),strottime($messages模板->线程->第一条消息日期)),如果是数组($messages\u template->thread->recipients)){foreach($messages\u template->thread->recipients as$recipient){if(空($recipient->is\u deleted)){$threads->threads[$i]['recipients'][]=array('avatar'=>esc\u url(bp\u core\u fetch\u avatar(array('item\u id'=>$recipient->user\u id',object'=>'user',type'=>'thumb',width'=>BP\u AVATAR\u thumb\u width',height'=>BP\u AVATAR\u thumb\u height,'html'=>false,),'user\u link'=>BP\u core\u get\u userlink($recipient->user\u id,false,true),'user\u name'=>BP\u core\u get\u user\u显示名($recipient用户id),'is_you'=>$recipient->user_id==bp_loggedin_user_id());}}}如果(bp_处于活动状态('messages','star'){$star_link=bp_获取_消息_操作_链接(数组('thread_id'=>bp_获取消息_线程id(),'url_only'=>true,);$threads->threads[$i]['star link']star']star链接]]$star链接($star link数据链接($star)$threads->threads[$i]['is_starred']]=array_search('unstar',$star_link_data);//默认为last$sm_id=$last_message_id;if($threads->threads[$i]['is_starred i]['is_starred']]]]{$sm id=(int)$sm star link data[$threads->$i]['is_starred 1]]}$threads->threads[$i]['star nonce']=wp创建_-nonce('bp-sm id.$sm$threads->threads[$i]['starred_id']=$sm_id;}如果(bp_是活动的('media')&&bp_是消息的媒体支持()){$media_id=bp_消息的获取元($last_message_id,'bp_media_id',true);如果(!empty($media_id)){$media_id=explode(',',$media_id=explode>,$media_id)}如果(sizeof($media_id)<2){$i[$threads][__('sent a photo','buddyboss');}else{$threads->threads[$i]['extract']]={uuuuuu('sent a photo','buddyboss');}}else如果(bp_是活动的('media')&&bp_是消息的{gif_是支持的()){$gif数据=bp_消息的}获取元('last_messages->id,'ugif数据的),true);如果(!empty($gif数据))$threads[$i]]__('sent a gif','buddyboss');}$thread\u extra\u content=bp\u nouveau\u messages\u hook\u content(数组('inboxListItem'=>'bp\u messages\u inbox\u list\u item','threadOptions'=>'bp\u messages\u thread\u options',);if(数组过滤器($threads\u extra\u content)){$threads->threads->threads[$i]=array\u merge($threads->threads->线程[$i],$thread extra\u content)})$i+=1;endwhile;$threads->threads=array\u filter( $threads->threads ); $extra_content = bp_nouveau_messages_catch_hook_content( array( 'beforeLoop' => 'bp_before_member_messages_loop', 'afterLoop' => 'bp_after_member_messages_loop', ) ); if ( array_filter( $extra_content ) ) { $threads->extraContent = $extra_content; } // Remove the bp_current_action() override. $bp->current_action = $reset_action; // Return the successfull reply. wp_send_json_success( $threads ); }
更新日志
版本 | 描述 |
---|---|
BuddyPress 3.0.0 | 介绍了。 |