BBP_Admin::enqueue_scripts()

Enqueue any admin scripts we might need

Description

Source

File: bp-forums/admin/admin.php

	public function enqueue_scripts() {
		wp_enqueue_script( 'suggest' );

		// Get the version to use for JS
		$version = bbp_get_version();

		// Post type checker (only topics and replies)
		if ( 'post' === get_current_screen()->base ) {
			switch( get_current_screen()->post_type ) {
				case bbp_get_reply_post_type() :
				case bbp_get_topic_post_type() :

					// Enqueue the common JS
					wp_enqueue_script( 'bbp-admin-common-js', $this->js_url . 'common.js', array( 'jquery' ), $version );

					// Topics admin
					if ( bbp_get_topic_post_type() === get_current_screen()->post_type ) {
						wp_enqueue_script( 'bbp-admin-topics-js', $this->js_url . 'topics.js', array( 'jquery' ), $version );

					// Replies admin
					} elseif ( bbp_get_reply_post_type() === get_current_screen()->post_type ) {
						wp_enqueue_script( 'bbp-admin-replies-js', $this->js_url . 'replies.js', array( 'jquery' ), $version );
						$localize_array = array(
							'loading_text' => __( 'Loading', 'buddyboss' ),
						);
						wp_localize_script( 'bbp-admin-replies-js', 'replies_data', $localize_array );
					}

					break;
			}
		}
	}

Changelog

Changelog
Version Description
bbPress (r4260) 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.