BP\u REST\u通知\u端点::BP\u REST\u获取\u通知\u操作(BP\u通知\u通知美元的通知)

要执行的操作。

描述

参数

美元的通知

(BP\u通知\u通知)(必选)通知对象。

返回

(数组|字符串)

文件:bp-notifications /类/ class-bp-rest-notifications-endpoint.php

公共函数bp_rest_get_notification_actions($notification){$component_action=$notification->component_action;$data=array('status'=>'','accept'=>array(),'reject'=>array(),);开关($component_action){case'friends\u accepted':case'membership\u request\u accepted':case'member\u promoted\u to\u admin':case'member\u promoted\u to\u mod':break;case'friends\u request':如果(!empty($notification->secondary\u item\u id)&&bp\u处于活动状态('friends')&&class\u存在('bp\friends\u friends')){$Friends=new-BP\u-Friends\u-Friends($notification->secondary\u-item\u-id);if($Friends->id====$notification->secondary\u-item\u-id){$if(!empty($Friends->is\u-confirm)){$data['status']=\u('Accepted',buddyboss');}否则{$data['accept'['endpoint]=rest\u-url($this->namespace./'.buddypress()->friends->id./'.$friends->id);$data['accept']['method']='PATCH';$data['accept']['accept']['link\u url']=bp_loggedin\u user\u domain().bp_get\u friends\u slug();$data['reject'['endpoint]=rest\url($this->namespace./'.buddypress()->friends id)->friends id.$data['reject']='DELETE'$data['reject']['link_url']=bp_loggedin_user_domain().bp_get_friends_slug()}}else{$data['status']='uuuu('Rejected','buddyboss')}break;case'new_membership_request':如果(!empty($notification->secondary_item_item_item_id)&&bp_处于活动状态('groups')&&function_存在('groups_获取_请求){$group=groups)($notification->item_id);$is_member=groups\u is_user_member($notification->secondary_item_id,$notification->item_id);if(!empty($is_member)){$data['status']==uuu('Accepted','buddyboss');}else{$requests=groups\u获取请求(数组('user_id'=>$notification->secondary_item_id,'item_id'=>$notification->item_id.));if(!empty($requests)){$current_request=current($requests);if(!empty($current_request->accepted)){$data['status']=uuu('accepted','buddyboss');$data['accept']['endpoint']=rest_url('this->namespace./'buddypress())->组->id./membership requests/.$current\u request->id);$data['accept'['method']='PATCH';$data['accept']['link\u url']=trailingslashit(bp\u get\u group\u permalink($group)。'members');$data['reject'['endpoint']['endpoint]=rest\u url($this->namespace./'.buddypress()->组->id./membership requests/'.$current\u request->id);$data['reject']['method']='DELETE'.$data['reject'.['link_url']]=trailingslashit(bp_get_group_permalink($group.'members');}其他{$data['status']=$data['status'.['reject','buddyboss'.}}break;case'group_invite':if(bp_处于活动状态('groups')&&function_存在('groups_获取邀请'))){$group=groups_获取组('id){$id)$is_member=groups\u is_user_member($notification->user_id,$notification->item_id);if(!empty($is_member)){$data['status']===uu('status','buddyboss');}否则{$invests=groups\u获得邀请(数组('user_id'=>$notification->user_id,'item_id'=>$notification->item->item_id,);if(!empty($invests)){$current\u invests){$current\($invites);如果(!empty($current_-invites->accepted)){$data['status']=='uuu('accepted','buddyboss');$data['accept']['endpoint']=rest_-url($this->namespace./'.buddypress()->groups->id./invites/'.$current_-invites->id);$data['accept'['method']='PATCH'.$data['accept']['link_url']=bp_get_group_permalink($group);$data['reject']['endpoint']=rest_url($this->namespace./'.buddypress()->groups->id./invests/'.$current_invests->id);$data['reject']['method']='DELETE'.$data['reject'.['reject'['url']=bp_get_group_permalink($group)}否则{$data['status''.]break;}if(数组('status'=>'','accept'=>array(),'reject'=>array(),)====$data){return';}返回$data;}

问题?

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