BP_Members_Admin::enqueue_scripts()

Add some specific styling to the Edit User and Edit User’s Profile page.


Description Description


Source Source

File: bp-members/classes/class-bp-members-admin.php

	public function enqueue_scripts() {
		if ( ! in_array( get_current_screen()->id, $this->screen_id ) ) {
			return;
		}

		$min = bp_core_get_minified_asset_suffix();
		$css = $this->css_url . "admin{$min}.css";

		/**
		 * Filters the CSS URL to enqueue in the Members admin area.
		 *
		 * @since 2.0.0
		 *
		 * @param string $css URL to the CSS admin file to load.
		 */
		$css = apply_filters( 'bp_members_admin_css', $css );

		wp_enqueue_style( 'bp-members-css', $css, array(), bp_get_version() );

		wp_style_add_data( 'bp-members-css', 'rtl', 'replace' );
		if ( $min ) {
			wp_style_add_data( 'bp-members-css', 'suffix', $min );
		}

		// Only load JavaScript for BuddyPress profile.
		if ( get_current_screen()->id == $this->user_page ) {
			$js = $this->js_url . "admin{$min}.js";

			/**
			 * Filters the JS URL to enqueue in the Members admin area.
			 *
			 * @since 2.0.0
			 *
			 * @param string $js URL to the JavaScript admin file to load.
			 */
			$js = apply_filters( 'bp_members_admin_js', $js );
			wp_enqueue_script( 'bp-members-js', $js, array( 'jquery' ), bp_get_version(), true );
		}

		/**
		 * Fires after all of the members JavaScript and CSS are enqueued.
		 *
		 * @since 2.0.0
		 *
		 * @param string $id        ID of the current screen.
		 * @param array  $screen_id Array of allowed screens to add scripts and styles to.
		 */
		do_action( 'bp_members_admin_enqueue_scripts', get_current_screen()->id, $this->screen_id );
	}

Top ↑

Changelog Changelog

Changelog
Version Description
2.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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