Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

LLMS_Nav_Menus::get_nav_items()

Retrieve a filtered array of custom LifterLMS nav menu items.


Return Return

(array)


Top ↑

Source Source

File: includes/class.llms.nav.menus.php

	private function get_nav_items() {

		$items = array();

		foreach ( LLMS_Student_Dashboard::get_tabs() as $id => $data ) {

			if ( ! empty( $data['nav_item'] ) ) {

				$url = ! empty( $data['endpoint'] ) ? llms_get_endpoint_url( $data['endpoint'], '', llms_get_page_url( 'myaccount' ) ) : '';

				// No URL no nav item.
				if ( empty( $url ) ) {
					if ( empty( $data['url'] ) ) {
						continue;
					} else {
						$url = $data['url'];
					}
				}

				$title = empty( $data['title'] ) ? '' : $data['title'];

				$items[ $id ] = array(
					'url'   => $url,
					'label' => $title,
					'title' => $title,
				);

			}
		}

		$items['signin']  = array(
			'url'   => '#llms-signin',
			'label' => __( 'Sign In', 'lifterlms' ),
			'title' => __( 'Sign In', 'lifterlms' ),
		);
		$items['signout'] = array(
			'url'   => '#llms-signout',
			'label' => __( 'Sign Out', 'lifterlms' ),
			'title' => __( 'Sign Out', 'lifterlms' ),
		);

		/**
		 * Filters array of custom LifterLMS nav menu items
		 *
		 * @since 3.14.7
		 *
		 * @param array $items Array of custom LifterLMS nav menu items.
		 */
		return apply_filters( 'llms_nav_menu_items', $items );

	}


Top ↑

Changelog Changelog

Changelog
Version Description
3.37.12 Fixed possible access to undefined index. Excluded endpoints with an empty url.
3.14.7 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.