bp_core_admin_help_main_page()

Show the main index page of HELP page

Description

Source

File: bp-core/admin/bp-core-admin-help.php

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
function bp_core_admin_help_main_page() {
    $base_path   = buddypress()->plugin_dir . 'bp-help';
    $docs_path   = $base_path . '/docs/';
    $vendor_path = $base_path . '/vendors';
 
    $main_directories = glob( $docs_path . '*', GLOB_ONLYDIR );
 
    $article_value = bp_core_admin_help_get_article_value();
 
    if ( ! empty( $main_directories ) ) {
        if ( empty( $article_value ) ) {
            ?>
            <div class="bp-help-main-menu-wrap">
                <?php
                bp_core_admin_help_main_menu( $main_directories, $docs_path );
                ?>
            </div>
            <?php
        } else {
            /**
             * Sidebar main dir path
             */
            $article_dir_array = explode( "/", $article_value );
            $content_main_dir  = $docs_path . $article_dir_array[0];
 
            /**
             * Show display sidebar or not
             */
            $sidebar = false !== strpos( $article_value, 'miscellaneous' ) ? false : true;
            ?>
 
            <div class="bp-help-content-wrap">
 
                <?php
                if ( $sidebar ) {
                    ?>
                    <div class="bp-help-sidebar">
                        <?php
                        bp_core_admin_help_sub_menu( (array) $content_main_dir, '1', $docs_path, 2 );
                        ?>
                    </div>
                    <?php
                }
                ?>
 
                <div class="bp-help-content">
                    <ul class="bp-help-menu">
                        <?php
                        add_action( 'bp_core_admin_help_sub_menu_before', 'bp_core_admin_help_sub_menu_before_callback', 10, 5 );
                        bp_core_admin_help_sub_menu( (array) $content_main_dir, '1', $docs_path, 2, true );
                        remove_action( 'bp_core_admin_help_sub_menu_before', 'bp_core_admin_help_sub_menu_before_callback', 10 );
                        ?>
                    </ul>
 
 
                    <?php
 
                    // print file content
                    echo bp_core_admin_help_display_content( $docs_path . $article_value );
 
 
                    // print submenu
                    if ( bp_core_admin_help_had_more_directory( $docs_path . $article_value ) ) {
                        unset( $article_dir_array[ ( count( $article_dir_array ) - 1 ) ] );
                        $article_dir_array  = implode( '/', $article_dir_array );
                        $current_doc_path[] = $docs_path . $article_dir_array;
                        ?>
                        <div class="article-child well">
                            <?php
                            printf( '<h3>%s</h3>', __( 'Articles', 'buddyboss' ) );
                            bp_core_admin_help_sub_menu( $current_doc_path, '1', $docs_path, 3, false, true );
                            ?>
                        </div>
                        <?php
                    }
                    ?>
                </div>
 
            </div>
            <?php
        }
    }
}

Changelog

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