Core::setup_admin_bar()

Add Course tab in admin menu

Description

Source

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

199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
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.