BP_XProfile_Component::late_includes()

Late includes method.


Description Description

Only load up certain code when on specific pages.


Source Source

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

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

		// Bail if not on a user page.
		if ( ! bp_is_user() ) {
			return;
		}

		// User nav.
		if ( bp_is_profile_component() ) {
			require $this->path . 'bp-xprofile/screens/public.php';

			// Action - Delete avatar.
			if ( is_user_logged_in()&& bp_is_user_change_avatar() && bp_is_action_variable( 'delete-avatar', 0 ) ) {
				require $this->path . 'bp-xprofile/actions/delete-avatar.php';
			}

			// Sub-nav items.
			if ( is_user_logged_in() &&
				in_array( bp_current_action(), array( 'edit', 'change-avatar', 'change-cover-image' ), true )
			) {
				require $this->path . 'bp-xprofile/screens/' . bp_current_action() . '.php';
			}
		}

		// Settings.
		if ( is_user_logged_in() && bp_is_user_settings_profile() ) {
			require $this->path . 'bp-xprofile/screens/settings-profile.php';
		}
	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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