groups_notification_new_membership_request( int $requesting_user_id, int $admin_id, int $group_id, int $membership_id )
Notify group admin about new membership request.
Description
Parameters
- $requesting_user_id
-
(Required) ID of the user requesting group membership.
- $admin_id
-
(Required) ID of the group admin.
- $group_id
-
(Required) ID of the group.
- $membership_id
-
(Required) ID of the group membership object.
Source
File: bp-groups/bp-groups-notifications.php
function groups_notification_new_membership_request( $requesting_user_id = 0, $admin_id = 0, $group_id = 0, $membership_id = 0 ) { // Trigger a BuddyPress Notification. if ( bp_is_active( 'notifications' ) ) { bp_notifications_add_notification( array( 'user_id' => $admin_id, 'item_id' => $group_id, 'secondary_item_id' => $requesting_user_id, 'component_name' => buddypress()->groups->id, 'component_action' => 'new_membership_request', ) ); } // Bail if member opted out of receiving this email. if ( 'no' === bp_get_user_meta( $admin_id, 'notification_groups_membership_request', true ) ) { return; } $unsubscribe_args = array( 'user_id' => $admin_id, 'notification_type' => 'groups-membership-request', ); $group = groups_get_group( $group_id ); $args = array( 'tokens' => array( 'admin.id' => $admin_id, 'group' => $group, 'group.name' => $group->name, 'group.id' => $group_id, 'group-requests.url' => esc_url( bp_get_group_permalink( $group ) . 'admin/membership-requests' ), 'membership.id' => $membership_id, 'profile.url' => esc_url( bp_core_get_user_domain( $requesting_user_id ) ), 'requesting-user.id' => $requesting_user_id, 'requesting-user.name' => bp_core_get_user_displayname( $requesting_user_id ), 'unsubscribe' => esc_url( bp_email_get_unsubscribe_link( $unsubscribe_args ) ), ), ); bp_send_email( 'groups-membership-request', (int) $admin_id, $args ); }
Changelog
Version | Description |
---|---|
BuddyPress 1.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.