Group_Invite::accept( $args,  $assoc_args )

Accept a group invitation.


Description Description

Top ↑

OPTIONS OPTIONS

–group-id= : Identifier for the group. Accepts either a slug or a numeric ID.

–user-id= : Identifier for the user. Accepts either a user_login or a numeric ID.

Top ↑

EXAMPLES EXAMPLES

$ wp bp group invite accept --group-id=3 --user-id=10
Success: User is now a "member" of the group.

$ wp bp group invite accept --group-id=foo --user-id=admin
Success: User is now a "member" of the group.

Source Source

File: cli/src/group-invite.php

	public function accept( $args, $assoc_args ) {
		$group_id = $this->get_group_id_from_identifier( $assoc_args['group-id'] );
		$user     = $this->get_user_id_from_identifier( $assoc_args['user-id'] );

		if ( groups_accept_invite( $user->ID, $group_id ) ) {
			WP_CLI::success( 'User is now a "member" of the group.' );
		} else {
			WP_CLI::error( 'Could not accept user invitation to the group.' );
		}
	}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.