BP_Invitation_Manager::accept_request( array $args = array() )

Accept invitation, based on provided filter parameters.


Description Description

See also See also


Top ↑

Parameters Parameters

$args

(array) (Optional) Invitation characteristics. Some basic info is required to accept an invitation, because we'll need to accept all similar invitations and requests.

  • 'user_id'
    (int) User ID of the invitee.
  • 'item_id'
    (int) Item ID of the invitation to accept.
  • 'secondary_item_id'
    (int) Optional. Secondary item ID if needed.
  • 'date_modified'
    (string) Modified time in 'Y-m-d h:i:s' format, GMT. Defaults to current time if not specified.

Default value: array()


Top ↑

Return Return

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


Top ↑

Source Source

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

	 public function accept_request( $args = array() ) {

		$r = bp_parse_args( $args, array(
			'user_id'           => 0,
			'item_id'           => null,
			'secondary_item_id' => null,
			'date_modified'     => bp_core_current_time(),
		), 'accept_request' );
		$r['class'] = $this->class_name;

		if ( ! ( $r['user_id'] && $r['class'] && $r['item_id'] ) ) {
			return false;
		}

		if ( ! $this->request_exists( $r ) ) {
			return false;
		}

		$success = $this->run_acceptance_action( 'request', $r );
		if ( $success ) {
			// Update/Delete all related invitations & requests to this item for this user.
			$this->mark_accepted( $r );

			// Allow plugins an opportunity to act on the change.
			do_action( 'bp_invitations_accepted_request', $r );
		}
		return $success;
	}


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.