dozent_get_dashboard_url_segment()

Get Dozent Dashboard URL segment


Parameters

$full_segment

(bool) (Required)


Return

(array|bool|mixed|string)


Source

File: includes/template-functions.php

	function dozent_get_dashboard_url_segment() {
		$is_dashboard = is_dozent_dashboard();
		if ( ! $is_dashboard ) {
			return false;
		}

		global $wp_query;

		$permalink_structure = get_option( 'permalink_structure' );
		$url_segment = dozent_array_get( 'query_vars.dozent_dashboard_page', $wp_query );

		if ( empty( $permalink_structure ) ){
			$page_id = dozent_array_get( 'query.page_id', $wp_query );
			$first_slash_place = strpos( $page_id, '/' );
			if ( $first_slash_place !== false ){
			    $url_segment = str_replace( substr( $page_id, 0, $first_slash_place + 1 ), '', $page_id ) ;
            }
        }

		/**
         * Checking if sub URL of the dashboard
         *
		 * Example: url/dashboard/settings/reset-password
		 */
		$sub_segment = dozent_array_get( 'query_vars.dozent_dashboard_sub_page', $wp_query );
		$sub_segment = trim( $sub_segment );
		if ( ! empty( $sub_segment ) ) {
			$url_segment = trailingslashit( $url_segment ) . $sub_segment;
		}

		return $url_segment;
	}


Changelog

Changelog
Version Description
DozentLMS 1.0.0 Introduced.