BP_Groups_Invite_Template::the_invite()

Sets up the invite to show.


Source Source

File: bp-groups/classes/class-bp-groups-invite-template.php

	public function the_invite() {
		global $group_id;

		$this->in_the_loop  = true;
		$user_id            = $this->next_invite();

		$this->invite       = new stdClass;
		$this->invite->user = $this->invite_data[ $user_id ];

		// This method previously populated the user object with
		// BP_Core_User. We manually configure BP_Core_User data for
		// backward compatibility.
		if ( bp_is_active( 'xprofile' ) ) {
			$this->invite->user->profile_data = BP_XProfile_ProfileData::get_all_for_user( $user_id );
		}

		$this->invite->user->avatar = bp_core_fetch_avatar(
			array(
				'item_id' => $user_id,
				'type'    => 'full',
				'alt'     => sprintf(
					/* translators: %s: member name */
					__( 'Profile photo of %s', 'buddypress' ),
					$this->invite->user->fullname
				)
			)
		);

		$this->invite->user->avatar_thumb = bp_core_fetch_avatar(
			array(
				'item_id' => $user_id,
				'type'    => 'thumb',
				'alt'     => sprintf(
					/* translators: %s: member name */
					__( 'Profile photo of %s', 'buddypress' ),
					$this->invite->user->fullname
				)
			)
		);

		$this->invite->user->avatar_mini = bp_core_fetch_avatar(
			array(
				'item_id' => $user_id,
				'type'    => 'thumb',
				'alt'     => sprintf(
					/* translators: %s: member name */
					__( 'Profile photo of %s', 'buddypress' ),
					$this->invite->user->fullname
				),
				'width'   => 30,
				'height'  => 30
			)
		);

		$this->invite->user->email     = $this->invite->user->user_email;
		$this->invite->user->user_url  = bp_core_get_user_domain( $user_id, $this->invite->user->user_nicename, $this->invite->user->user_login );
		$this->invite->user->user_link = "<a href='{$this->invite->user->user_url}'>{$this->invite->user->fullname}</a>";

		/* translators: %s: last activity timestamp (e.g. "Active 1 hour ago") */
		$this->invite->user->last_active = bp_core_get_last_activity( $this->invite->user->last_activity, __( 'Active %s', 'buddypress' ) );

		if ( bp_is_active( 'groups' ) ) {
			$total_groups = BP_Groups_Member::total_group_count( $user_id );
			$this->invite->user->total_groups = sprintf( _n( '%d group', '%d groups', $total_groups, 'buddypress' ), $total_groups );
		}

		if ( bp_is_active( 'friends' ) ) {
			$this->invite->user->total_friends = BP_Friends_Friendship::total_friend_count( $user_id );
		}

		$this->invite->user->total_blogs = null;

		// Global'ed in bp_group_has_invites()
		$this->invite->group_id = $group_id;

		// loop has just started
		if ( 0 == $this->current_invite ) {

			/**
			 * Fires if the current invite item is the first in the loop.
			 *
			 * @since 1.1.0
			 * @since 2.3.0 `$this` parameter added.
			 * @since 2.7.0 Action renamed from `loop_start`.
			 *
			 * @param BP_Groups_Invite_Template $this Instance of the current Invites template.
			 */
			do_action( 'group_invitation_loop_start', $this );
		}
	}


Top ↑

Changelog Changelog

Changelog
Version Description
1.1.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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