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

Update invitations.


Description Description

See also See also


Top ↑

Parameters 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()


Top ↑

Return Return

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


Top ↑

Source 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 5.0.0
		 *
		 * @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 5.0.0
		 *
		 * @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;
	}

Top ↑

Changelog Changelog

Changelog
Version Description
5.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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