Core::setup_admin_bar()

Add Course tab in admin menu

Description

Source

File: bp-integrations/learndash/core/Core.php

	public function setup_admin_bar() {

		$all_post_types = array(
			array(
				'name'     => $this->course_name,
				'slug'     => $this->course_slug,
				'parent'   => 'buddypress',
				'nav_link' => $this->adminbar_nav_link( $this->course_slug ),
				'position' => 1,
			),
			array(
				'name'     => $this->my_courses_name,
				'slug'     => $this->my_courses_slug,
				'parent'   => $this->course_slug,
				'nav_link' => $this->adminbar_nav_link( $this->course_slug ),
				'position' => 1,
			),
		);

		if ( $this->certificates_enables ) {
			$all_post_types[] = array(
				'name'     => $this->my_certificates_tab_name,
				'slug'     => $this->certificates_tab_slug,
				'parent'   => $this->course_slug,
				'nav_link' => $this->adminbar_nav_link( $this->certificates_tab_slug, $this->course_slug ),
				'position' => 2,
			);
		}

		global $wp_admin_bar;
		foreach ( $all_post_types as $single ) {
			$wp_admin_bar->add_menu( array(
				'parent'   => 'my-account-' . $single['parent'],
				'id'       => 'my-account-' . $single['slug'],
				'title'    => $single['name'],
				'href'     => $single['nav_link'],
				'position' => $single['position'],
			) );
		}
	}

Changelog

Changelog
Version Description
BuddyBoss 1.2.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.