bp_invites_member_invite_activate_user( $user_id,  $key,  $user )

Mark the invited user as registered.

Description

Parameters

$user_id

(Required)

$key

(Required)

$user

(Required)

Source

File: bp-invites/bp-invites-functions.php

function bp_invites_member_invite_activate_user( $user_id, $key, $user ) {
	global $bp;

	$email = bp_core_get_user_email( $user_id );

	$inviters 	= array();

	$args = array(
		'post_type'  => bp_get_invite_post_type(),
		'posts_per_page' => -1,
		'meta_query' => array(
			array(
				'key'     => '_bp_invitee_email',
				'value'   => $email,
				'compare' => '=',
			),
		),
	);

	$bp_get_invitee_email = new WP_Query( $args );

	if ( $bp_get_invitee_email->have_posts() ) {

		// From the posts returned by the query, get a list of unique inviters
		while ( $bp_get_invitee_email->have_posts() ) {
			$bp_get_invitee_email->the_post();

			$inviter_id	= get_the_author_meta( 'ID' );
			$inviters[] 	= $inviter_id;

			// Mark as accepted
			update_post_meta( get_the_ID(), '_bp_invitee_status', 1 );
			update_post_meta( get_the_ID(), '_bp_invitee_registered_date', date( 'Y-m-d H:i:s' ) );

			$member_type = get_post_meta( get_the_ID(), '_bp_invitee_member_type', true );
			if ( isset( $member_type ) && !empty( $member_type ) ) {
				bp_set_member_type( $user_id, '' );
				bp_set_member_type( $user_id, $member_type );
			}
		}

	}

}

Changelog

Changelog
Version Description
BuddyBoss 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.