bp_members_invitations_invite_user( array|string $args = array() )
Invite a user to a BP community.
Parameters Parameters
- $args
-
(array|string) (Optional) Array of arguments.
- 'invitee_email'
(int) Email address of the user being invited. - 'network_id'
(int) ID of the network to which the user is being invited. - 'inviter_id'
(int) Optional. ID of the inviting user. Default: ID of the logged-in user. - 'date_modified'
(string) Optional. Modified date for the invitation. Default: current date/time. - 'content'
(string) Optional. Message to invitee. - 'send_invite'
(bool) Optional. Whether the invitation should be sent now. Default: false.
Default value: array()
- 'invitee_email'
Return Return
(bool) True on success, false on failure.
Source Source
File: bp-members/bp-members-functions.php
function bp_members_invitations_invite_user( $args = array() ) { $r = bp_parse_args( $args, array( 'invitee_email' => '', 'network_id' => get_current_network_id(), 'inviter_id' => bp_loggedin_user_id(), 'date_modified' => bp_core_current_time(), 'content' => '', 'send_invite' => 0 ), 'members_invitations_invite_user' ); $inv_args = array( 'invitee_email' => $r['invitee_email'], 'item_id' => $r['network_id'], 'inviter_id' => $r['inviter_id'], 'date_modified' => $r['date_modified'], 'content' => $r['content'], 'send_invite' => $r['send_invite'] ); // Create the invitataion. $invites_class = new BP_Members_Invitation_Manager(); $created = $invites_class->add_invitation( $inv_args ); /** * Fires after the creation of a new network invite. * * @since 8.0.0 * * @param array $r Array of parsed arguments for the network invite. * @param int|bool $created The ID of the invitation or false if it couldn't be created. */ do_action( 'bp_members_invitations_invite_user', $r, $created ); return $created; }
Expand full source code Collapse full source code View on Trac
Changelog Changelog
Version | Description |
---|---|
8.0.0 | Introduced. |