BP_Members_Admin::enqueue_scripts()

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


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 );

			if ( ! bp_core_get_root_option( 'bp-disable-avatar-uploads' ) && buddypress()->avatar->show_avatars ) {
				/**
				 * Get Thickbox.
				 *
				 * We cannot simply use add_thickbox() here as WordPress is not playing
				 * nice with Thickbox width/height see https://core.trac.wordpress.org/ticket/17249
				 * Using media-upload might be interesting in the future for the send to editor stuff
				 * and we make sure the tb_window is wide enough
				 */
				wp_enqueue_style ( 'thickbox' );
				wp_enqueue_script( 'media-upload' );

				// Get Avatar Uploader.
				bp_attachments_enqueue_scripts( 'BP_Attachment_Avatar' );
			}
		}

		/**
		 * 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.