1 | <?php |
---|
2 | |
---|
3 | function bp_plugin_types() { |
---|
4 | // Sub-item of core component |
---|
5 | bp_core_new_subnav_item( array( |
---|
6 | 'name' => 'Test1', |
---|
7 | 'slug' => 'test1', |
---|
8 | 'parent_slug' => 'settings', |
---|
9 | 'parent_url' => bp_displayed_user_domain() . 'settings/', |
---|
10 | 'screen_function' => 'bp_plugin_type_pluginsphp', |
---|
11 | ) ); |
---|
12 | |
---|
13 | // Sub-item of plugin component - not registered as active |
---|
14 | bp_core_new_nav_item( array( |
---|
15 | 'name' => 'Test2 Parent', |
---|
16 | 'slug' => 'test2-parent', |
---|
17 | 'screen_function' => 'bp_plugin_type_pluginsphp', |
---|
18 | 'default_subnav_slug' => 'test2', |
---|
19 | ) ); |
---|
20 | bp_core_new_subnav_item( array( |
---|
21 | 'name' => 'Test2', |
---|
22 | 'slug' => 'test2', |
---|
23 | 'parent_slug' => 'test2-parent', |
---|
24 | 'parent_url' => bp_displayed_user_domain() . 'settings/', |
---|
25 | 'screen_function' => 'bp_plugin_type_pluginsphp', |
---|
26 | ) ); |
---|
27 | bp_core_new_subnav_item( array( |
---|
28 | 'name' => 'Test2 Sibling', |
---|
29 | 'slug' => 'test2-sibling', |
---|
30 | 'parent_slug' => 'test2-parent', |
---|
31 | 'parent_url' => bp_displayed_user_domain() . 'settings/', |
---|
32 | 'screen_function' => 'bp_plugin_type_pluginsphp', |
---|
33 | ) ); |
---|
34 | |
---|
35 | // Sub-item of plugin component - registered as active |
---|
36 | add_filter( 'bp_active_components', function( $c ) { |
---|
37 | $c['test3-parent'] = 1; |
---|
38 | return $c; |
---|
39 | } ); |
---|
40 | bp_core_new_nav_item( array( |
---|
41 | 'name' => 'Test3 Parent', |
---|
42 | 'slug' => 'test3-parent', |
---|
43 | 'screen_function' => 'bp_plugin_type_pluginsphp', |
---|
44 | 'default_subnav_slug' => 'test3', |
---|
45 | ) ); |
---|
46 | bp_core_new_subnav_item( array( |
---|
47 | 'name' => 'Test3', |
---|
48 | 'slug' => 'test3', |
---|
49 | 'parent_slug' => 'test3-parent', |
---|
50 | 'parent_url' => bp_displayed_user_domain() . 'settings/', |
---|
51 | 'screen_function' => 'bp_plugin_type_pluginsphp', |
---|
52 | ) ); |
---|
53 | bp_core_new_subnav_item( array( |
---|
54 | 'name' => 'Test3 Sibling', |
---|
55 | 'slug' => 'test3-sibling', |
---|
56 | 'parent_slug' => 'test3-parent', |
---|
57 | 'parent_url' => bp_displayed_user_domain() . 'settings/', |
---|
58 | 'screen_function' => 'bp_plugin_type_pluginsphp', |
---|
59 | ) ); |
---|
60 | } |
---|
61 | add_action( 'bp_setup_nav', 'bp_plugin_types', 10000 ); |
---|
62 | |
---|
63 | function bp_plugin_type_pluginsphp() { |
---|
64 | add_action( 'bp_template_content', 'bp_plugin_type_display_cb' ); |
---|
65 | bp_core_load_template( 'members/single/plugins' ); |
---|
66 | } |
---|
67 | |
---|
68 | function bp_plugin_type_display_cb() { |
---|
69 | echo 'ok'; |
---|
70 | } |
---|
71 | |
---|