BP_Members_Admin::enqueue_scripts()

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

Description

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 BuddyPress 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', true );
		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 BuddyPress 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 BuddyPress 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 );
	}

Changelog

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