Skip to content

Commit

Permalink
Merge pull request #4424 from buddyboss/PROD-7527
Browse files Browse the repository at this point in the history
PROD-7527 - Group member page not loading when we set page request 1
  • Loading branch information
KartikSuthar authored Jun 5, 2024
2 parents efc13d5 + 3d5cb9c commit d19628c
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/bp-core/compatibility/bp-wp-offload-media-helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ public function bb_media_offload_delivery_provider( $delivery_provider ) {
/**
* Add extra parameter into localize scripts for offload media plugin.
*
* @since BuddyBos 2.6.20
* @since BuddyBoss 2.6.20
*
* @param array $params Localize scripts parameter.
*
Expand Down
2 changes: 1 addition & 1 deletion src/bp-groups/bp-groups-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -4418,7 +4418,7 @@ function bp_group_directory_page_content() {

$page_ids = bp_core_get_directory_page_ids();

if ( ! empty( $page_ids['groups'] ) ) {
if ( ! empty( $page_ids['groups'] ) && ! bp_is_group_subgroups() ) {
$group_page_content = get_post_field( 'post_content', $page_ids['groups'] );
echo apply_filters( 'the_content', $group_page_content );
}
Expand Down
2 changes: 1 addition & 1 deletion src/bp-groups/bp-groups-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ function bp_has_groups( $args = '' ) {
'update_admin_cache' => (bool) $r['update_admin_cache'],
);

if ( isset( $_POST['template'] ) && 'group_subgroups' === $_POST['template'] ) {
if ( ( isset( $_POST['template'] ) && 'group_subgroups' === $_POST['template'] ) || bp_is_group_subgroups() ) {
$descendant_groups = bp_get_descendent_groups( bp_get_current_group_id(), bp_loggedin_user_id() );
$ids = wp_list_pluck( $descendant_groups, 'id' );
$args['include'] = $ids;
Expand Down
15 changes: 14 additions & 1 deletion src/bp-templates/bp-nouveau/buddypress/groups/single/home.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
* @version 1.0.0
*/

if ( bp_is_group_subgroups() ) {
ob_start();
bp_nouveau_group_template_part();
$template_content = ob_get_contents();
ob_end_clean();
}

if ( bp_has_groups() ) {
while ( bp_groups() ) :
bp_the_group();
Expand All @@ -27,7 +34,13 @@
?>

<div id="item-body" class="item-body">
<?php bp_nouveau_group_template_part(); ?>
<?php
if ( bp_is_group_subgroups() ) {
echo $template_content; // phpcs:ignore
} else {
bp_nouveau_group_template_part();
}
?>
</div><!-- #item-body -->
</div><!-- // .bp-wrap -->

Expand Down
31 changes: 25 additions & 6 deletions src/bp-templates/bp-nouveau/buddypress/groups/single/members.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,41 @@
</div>

<?php
$is_send_ajax_request = bb_is_send_ajax_request();
switch ( bp_action_variable( 0 ) ) :

// Groups/All Members
case 'all-members':
?>
<div id="members-group-list" class="group_members dir-list" data-bp-list="group_members">
<div id="bp-ajax-loader"><?php bp_nouveau_user_feedback( 'group-members-loading' ); ?></div>
</div><!-- .group_members.dir-list -->
<div id="members-group-list" class="group_members dir-list" data-bp-list="group_members" data-ajax="<?php echo esc_attr( $is_send_ajax_request ? 'true' : 'false' ); ?>">
<?php
if ( $is_send_ajax_request ) {
?>
<div id="bp-ajax-loader"><?php bp_nouveau_user_feedback( 'group-members-loading' ); ?></div>
?>
<?php
} else {
bp_get_template_part( 'groups/single/members-loop' );
}
?>
</div>
<?php
break;

case 'leaders':
?>
<div id="members-group-list" class="group_members dir-list" data-bp-list="group_members">
<div id="bp-ajax-loader"><?php bp_nouveau_user_feedback( 'group-leaders-loading' ); ?></div>
</div><!-- .group_leaders.dir-list -->
<div id="members-group-list" class="group_members dir-list" data-bp-list="group_members" data-ajax="<?php echo esc_attr( $is_send_ajax_request ? 'true' : 'false' ); ?>">
<?php
if ( $is_send_ajax_request ) {
?>
<div id="bp-ajax-loader"><?php bp_nouveau_user_feedback( 'group-leaders-loading' ); ?></div>
?>
<?php
} else {
bp_get_template_part( 'groups/single/members-loop' );
}
?>
</div>
<?php
break;

Expand Down
15 changes: 12 additions & 3 deletions src/bp-templates/bp-nouveau/buddypress/groups/single/subgroups.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* @version 1.0.0
*/

$is_send_ajax_request = bb_is_send_ajax_request();

bp_nouveau_before_groups_directory_content();

if ( ! bp_nouveau_is_object_nav_in_sidebar() ) {
Expand All @@ -16,9 +18,16 @@
?>
<div class="screen-content">
<?php bp_get_template_part( 'common/search-and-filters-bar' ); ?>

<div id="groups-dir-list" class="groups dir-list" data-bp-list="group_subgroups">
<div id="bp-ajax-loader"><?php bp_nouveau_user_feedback( 'directory-groups-loading' ); ?></div>
<div id="groups-dir-list" class="groups dir-list" data-bp-list="group_subgroups" data-ajax="<?php echo esc_attr( $is_send_ajax_request ? 'true' : 'false' ); ?>">
<?php
if ( $is_send_ajax_request ) {
echo '<div id="bp-ajax-loader">';
bp_nouveau_user_feedback( 'directory-groups-loading' );
echo '</div>';
} else {
bp_get_template_part( 'groups/groups-loop' );
}
?>
</div><!-- #groups-dir-list -->

<?php bp_nouveau_after_groups_directory_content(); ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* @version 1.0.0
*/

$is_send_ajax_request = bb_is_send_ajax_request();

bp_get_template_part( 'members/single/parts/item-subnav' );

switch ( bp_current_action() ) :
Expand All @@ -16,7 +18,15 @@
bp_get_template_part( 'common/search-and-filters-bar' );
?>
<div id="notifications-user-list" class="notifications dir-list" data-bp-list="notifications">
<div id="bp-ajax-loader"><?php bp_nouveau_user_feedback( 'member-notifications-loading' ); ?></div>
<?php
if ( $is_send_ajax_request ) {
echo '<div id="bp-ajax-loader">';
bp_nouveau_user_feedback( 'member-notifications-loading' );
echo '</div>';
} else {
bp_get_template_part( 'members/single/notifications/notifications-loop' );
}
?>
</div><!-- #groups-dir-list -->
<?php
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,22 @@
* @version 1.5.6
*/

$is_send_ajax_request = bb_is_send_ajax_request();

switch ( bp_current_action() ) :
case 'blocked-members':
bp_nouveau_member_hook( 'before', 'moderation_content' );
?>
<div class="moderation" data-bp-list="moderation">
<div id="bp-ajax-loader">
<?php bp_nouveau_user_feedback( 'moderation-block-member-loading' ); ?>
</div>
<?php
if ( $is_send_ajax_request ) {
echo '<div id="bp-ajax-loader">';
bp_nouveau_user_feedback( 'moderation-block-member-loading' );
echo '</div>';
} else {
bp_get_template_part( 'moderation/moderation-loop' );
}
?>
</div>
<?php
bp_nouveau_member_hook( 'after', 'moderation_content' );
Expand Down
8 changes: 4 additions & 4 deletions src/bp-templates/bp-nouveau/js/buddypress-nouveau.js
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,10 @@ window.bp = window.bp || {};
this.setStorage( 'bp-' + data.object, 'extras', data.extras );
}

if ( ! _.isUndefined( data.ajaxload ) && false === data.ajaxload ) {
return false;
}

/* Set the correct selected nav and filter */
$( this.objectNavParent + ' [data-bp-object]' ).each(
function () {
Expand All @@ -538,10 +542,6 @@ window.bp = window.bp || {};
}
);

if ( ! _.isUndefined( data.ajaxload ) && false === data.ajaxload ) {
return false;
}

if ( $( this.objectNavParent + ' [data-bp-scope="' + data.scope + '"]' ).length ) {
$( this.objectNavParent + ' [data-bp-scope="' + data.scope + '"], #object-nav li.current' ).addClass( 'selected loading' );
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/bp-templates/bp-nouveau/js/buddypress-nouveau.min.js

Large diffs are not rendered by default.

0 comments on commit d19628c

Please sign in to comment.