BP\u REST\u通知\u端点::BP\u REST\u链接\u url\u更新(一串$url,BP\u通知\u通知$notification)
在请求接受/拒绝后更新链接URL。
描述
参数
- $url
-
(一串)(必选)通知的链接URL。
- $notification
-
(BP\u通知\u通知)(必选)通知对象。
回来
(字符串)
来源
文件:bp通知/classes/class-bp-rest-notifications-endpoint.php
公共函数bp_rest_link_url_update($url,$notification){$component_action=$notification->component_action;开关($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 Confirm)){$url=BP\u loggedin\u user\u domain().BP\u get\u Friends\u slug()}其他{$url=BP\u loggedin user\u domain().BP\u get\u Friends\u slug()}break;case'new_membership_request':if(!empty($notification->secondary_item_id)&&bp_处于活动状态('groups')&&function_存在('groups_get_requests'){$group=groups_get_group($notification->item_id);$is_member=groups_用户成员($notification->secondary_item_id,$notification->item->item_id);if(!empty($is_member)){$url=trailingslashit(bp_get_group_permalink($group)。'members');}其他{$requests=groups_get_requests(数组('user_id'=>$notification->secondary_item_id,'item_id'=>$notification->item_id,);if(空($requests)){$url=trailingslashit(bp_get_group_permalink($group)。'members');}}中断;案例“group_invite”:如果(bp_是活动的('groups')和&function_存在('groups_get_invests')){$group=groups_get_group($notification->item_id);$is_member=groups_是用户_成员($notification->user_id,$notification->item_id);if(!empty($is_member)){$url=bp_get_group_permalink($group)}else{$invests=groups\u获得邀请(数组)}('user\u id'=>$notification->user\u id',item\u id'=>$notification->item\u id,);if(空($invests)){$url=bp\u get\u group\u permalink($group);}}}}}}break;}return$url;}