BP_Invitation::update( array $update_args = array(), array $where_args = array() )

Update invitations.

Description

See also

Parameters

$update_args

(Optional) Associative array of fields to update, and the values to update them to. Of the format array( 'user_id' => 4, 'class' => 'BP_Groups_Invitation_Manager', ).

Default value: array()

$where_args

(Optional) Associative array of columns/values, to determine which rows should be updated. Of the format array( 'item_id' => 7, 'class' => 'BP_Groups_Invitation_Manager', ).

Default value: array()

Return

(int|bool) Number of rows updated on success, false on failure.

Source

File: bp-core/classes/class-bp-invitation.php

	public static function update( $update_args = array(), $where_args = array() ) {
		$update = self::get_query_clauses( $update_args );
		$where  = self::get_query_clauses( $where_args  );

		/**
		 * Fires before an invitation is updated.
		 *
		 * @since BuddyBoss 1.3.5

		 *
		 * @param array $where_args  Associative array of columns/values describing
		 *                           invitations about to be deleted.
		 * @param array $update_args Array of new values.
		 */
		do_action( 'bp_invitation_before_update', $where_args, $update_args );

		$retval = self::_update( $update['data'], $where['data'], $update['format'], $where['format'] );

		// Clear matching items from the cache.
		$cache_args = $where_args;
		$cache_args['fields'] = 'ids';
		$maybe_cached_ids = self::get( $cache_args );
		foreach ( $maybe_cached_ids as $invite_id ) {
			wp_cache_delete( $invite_id, 'bp_invitations' );
		}

		/**
		 * Fires after an invitation is updated.
		 *
		 * @since BuddyBoss 1.3.5
		 *
		 * @param array $where_args  Associative array of columns/values describing
		 *                           invitations about to be deleted.
		 * @param array $update_args Array of new values.
		 */
		do_action( 'bp_invitation_after_update', $where_args, $update_args );

  		return $retval;
	}

Changelog

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