forked from MESH-Research/boss-child
-
Notifications
You must be signed in to change notification settings - Fork 2
/
buddypress-group-single.php
224 lines (149 loc) · 7.99 KB
/
buddypress-group-single.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
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
<?php
global $class, $rtmedia_query;
?>
<!-- if widgets are loaded for any BuddyPress component, display the BuddyPress sidebar -->
<div class="page-right-sidebar <?php echo $class; ?>">
<!-- This is more dummy so plugins like buddypress-learndash can work, except rt media -->
<?php if ( $rtmedia_query && $rtmedia_query->query["context"] != 'group' ): ?>
<?php the_content(); ?>
<?php endif; ?>
<!-- BuddyPress template content -->
<div id="buddypress">
<?php if ( bp_has_groups() ) : while ( bp_groups() ) : bp_the_group(); ?>
<?php do_action( 'bp_before_group_home_content' ); ?>
<div id="item-header" role="complementary">
<?php
/**
* If the cover image feature is enabled, use a specific header
*/
// if ( bp_group_use_cover_image_header() ) :
// bp_get_template_part( 'groups/single/cover-image-header' );
// else :
bp_get_template_part( 'groups/single/group-header' );
// endif;
?>
<?php
ob_start();
do_action( 'bp_group_header_meta' );
$action_output = ob_get_contents();
ob_end_clean();
if(!empty($action_output)) {
echo '<div class="group-header-meta">';
echo $action_output;
echo '</div>';
}
?>
</div><!-- #item-header -->
<div id="primary" class="site-content"> <!-- moved from top -->
<div id="content" role="main"> <!-- moved from top -->
<div class="below-cover-photo">
<div id="group-description">
<?php bp_group_description(); ?>
</div>
</div>
<div id="item-nav"> <!-- movwed inside #primary-->
<div class="item-list-tabs no-ajax" id="object-nav" role="navigation">
<ul>
<?php bp_get_options_nav(); ?>
<?php do_action( 'bp_group_options_nav' ); ?>
</ul>
</div>
</div><!-- #item-nav -->
<div id="item-body">
<?php do_action( 'bp_before_group_body' );
/**
* Does this next bit look familiar? If not, go check out WordPress's
* /wp-includes/template-loader.php file.
*
* @todo A real template hierarchy? Gasp!
*/
// Looking at home location
if ( bp_is_group_home() ) :
if ( bp_group_is_visible() ) {
// Load appropriate front template
bp_groups_front_template_part();
} else {
/**
* Fires before the display of the group status message.
*
* @since 1.1.0
*/
do_action( 'bp_before_group_status_message' ); ?>
<div id="message" class="info">
<p><?php bp_group_status_message(); ?></p>
</div>
<?php
/**
* Fires after the display of the group status message.
*
* @since 1.1.0
*/
do_action( 'bp_after_group_status_message' );
}
// Not looking at home
else :
// Group Admin
if ( bp_is_group_admin_page() ) : bp_get_template_part( 'groups/single/admin' );
// Group Activity
elseif ( bp_is_group_activity() ) : bp_get_template_part( 'groups/single/activity' );
// Group Members
elseif ( bp_is_group_members() ) : bp_groups_members_template_part();
// Group Invitations
elseif ( bp_is_group_invites() ) : bp_get_template_part( 'groups/single/send-invites' );
// Old group forums
elseif ( bp_is_group_forum() ) : bp_get_template_part( 'groups/single/forum' );
// Membership request
elseif ( bp_is_group_membership_request() ) : bp_get_template_part( 'groups/single/request-membership' );
elseif ( $rtmedia_query && $rtmedia_query->query["context"] == 'group' ) : bp_get_template_part( 'groups/single/media');
// Anything else (plugins mostly)
else : bp_get_template_part( 'groups/single/plugins' );
endif;
endif;
do_action( 'bp_after_group_body' ); ?>
</div><!-- #item-body -->
</div><!-- #content -->
<?php
$search = ( isset( $_GET['bbp_search'] ) ) ? $_GET['bbp_search'] : false;
if(!empty($search)) :
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
?>
<div class="bbp-on-search-form">
<?php bbp_get_template_part( 'form', 'search' ); ?>
</div>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="forum-header page-header">
<h1 class="entry-title main-title search-title-results">Search Results for '<?php echo $search ?>' </h1>
</header><!-- .page-header -->
<div class="entry-content">
<div id="bbpress-forums">
<?php
if(bbp_has_search_results(array('s' => $search, 'paged' => $paged))) :
bbp_set_query_name( bbp_get_search_rewrite_id() );
do_action( 'bbp_template_before_search' );
bbp_get_template_part( 'pagination', 'search' );
bbp_get_template_part( 'loop', 'search' );
bbp_get_template_part( 'pagination', 'search' );
do_action( 'bbp_template_after_search_results' );
else :
?>
<div class="bbp-template-notice">
<p>No search results were found here.</p>
</div>
<?php endif; ?>
</div>
</div>
</article> <!-- #article -->
<?php endif; ?>
</div><!-- #primary -->
<?php
global $groups_template;
//backup the group current loop to ignore loop conflict from widgets
$groups_template_safe = $groups_template;
get_sidebar('buddypress');
//restore the oringal $groups_template before sidebar.
$groups_template = $groups_template_safe;
?>
<?php do_action( 'bp_after_group_home_content' ); ?>
<?php endwhile; endif; ?>
</div><!-- #buddypress -->
</div><!-- closing div -->