BP_Friends_Component::late_includes()

Late includes method.

Description

Only load up certain code when on specific pages.

Source

File: bp-friends/classes/class-bp-friends-component.php

	public function late_includes() {
		// Bail if PHPUnit is running.
		if ( defined( 'BP_TESTS_DIR' ) ) {
			return;
		}

		// Connections.
		if ( bp_is_user_friends() ) {
			// Authenticated actions.
			if ( is_user_logged_in() &&
				in_array( bp_current_action(), array( 'add-friend', 'remove-friend' ), true )
			) {
				require $this->path . 'bp-friends/actions/' . bp_current_action() . '.php';
			}

			// User nav.
			require $this->path . 'bp-friends/screens/my-friends.php';
			if ( is_user_logged_in() && bp_is_user_friend_requests() ) {
				require $this->path . 'bp-friends/screens/requests.php';
			}

			if ( is_user_logged_in() ) {
				require $this->path . 'bp-friends/screens/mutual-friends.php';
			}
		}
	}

Changelog

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