Skip to content

Commit

Permalink
Merge branch '1.6.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
boonebgorges committed Aug 8, 2024
2 parents 87b3aa6 + 0b50489 commit 5744a3d
Show file tree
Hide file tree
Showing 77 changed files with 1,703 additions and 730 deletions.
6 changes: 6 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": [ "plugin:@wordpress/eslint-plugin/recommended" ],
"rules": {
"prettier/prettier": "off"
}
}
10 changes: 5 additions & 5 deletions buddypress/activity/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<?php do_action( 'bp_before_activity_type_tab_all' ); ?>

<?php /* translators: total member count for site */ ?>
<li class="selected" id="activity-all"><a href="<?php echo esc_attr( bp_loggedin_user_domain() . BP_ACTIVITY_SLUG . '/' ); ?>" title="<?php esc_attr_e( 'The public activity for everyone on this site.', 'commons-in-a-box' ); ?>"><?php printf( esc_html__( 'All Members (%s)', 'commons-in-a-box' ), esc_html( bp_get_total_site_member_count() ) ); ?></a></li>
<li class="selected" id="activity-all"><a href="<?php echo esc_attr( bp_loggedin_user_url( bp_members_get_path_chunks( [ bp_get_activity_slug() ] ) ) ); ?>" title="<?php esc_attr_e( 'The public activity for everyone on this site.', 'commons-in-a-box' ); ?>"><?php printf( esc_html__( 'All Members (%s)', 'commons-in-a-box' ), esc_html( bp_get_total_site_member_count() ) ); ?></a></li>

<?php if ( is_user_logged_in() ) : ?>

Expand All @@ -29,7 +29,7 @@
<?php if ( function_exists( 'bp_get_total_friend_count' ) ) : ?>
<?php if ( bp_get_total_friend_count( bp_loggedin_user_id() ) ) : ?>
<?php /* translators: friend count for user */ ?>
<li id="activity-friends"><a href="<?php echo esc_attr( bp_loggedin_user_domain() . BP_ACTIVITY_SLUG . '/' . BP_FRIENDS_SLUG . '/' ); ?>" title="<?php esc_attr_e( 'The activity of my friends only.', 'commons-in-a-box' ); ?>"><?php printf( esc_html__( 'My Friends (%s)', 'commons-in-a-box' ), esc_html( bp_get_total_friend_count( bp_loggedin_user_id() ) ) ); ?></a></li>
<li id="activity-friends"><a href="<?php echo esc_attr( bp_loggedin_user_url( bp_members_get_path_chunks( [ bp_get_activity_slug(), bp_get_friends_slug() ] ) ) ); ?>" title="<?php esc_attr_e( 'The activity of my friends only.', 'commons-in-a-box' ); ?>"><?php printf( esc_html__( 'My Friends (%s)', 'commons-in-a-box' ), esc_html( bp_get_total_friend_count( bp_loggedin_user_id() ) ) ); ?></a></li>
<?php endif; ?>
<?php endif; ?>

Expand All @@ -38,21 +38,21 @@
<?php if ( function_exists( 'bp_get_total_group_count_for_user' ) ) : ?>
<?php if ( bp_get_total_group_count_for_user( bp_loggedin_user_id() ) ) : ?>
<?php /* translators: group count for user */ ?>
<li id="activity-groups"><a href="<?php echo esc_attr( bp_loggedin_user_domain() . BP_ACTIVITY_SLUG . '/' . BP_GROUPS_SLUG . '/' ); ?>" title="<?php esc_attr_e( 'The activity of groups I am a member of.', 'commons-in-a-box' ); ?>"><?php printf( esc_html__( 'My Groups (%s)', 'commons-in-a-box' ), esc_html( bp_get_total_group_count_for_user( bp_loggedin_user_id() ) ) ); ?></a></li>
<li id="activity-groups"><a href="<?php echo esc_attr( bp_loggedin_user_url( bp_members_get_path_chunks( [ bp_get_activity_slug(), bp_get_groups_slug() ] ) ) ); ?>" title="<?php esc_attr_e( 'The activity of groups I am a member of.', 'commons-in-a-box' ); ?>"><?php printf( esc_html__( 'My Groups (%s)', 'commons-in-a-box' ), esc_html( bp_get_total_group_count_for_user( bp_loggedin_user_id() ) ) ); ?></a></li>
<?php endif; ?>
<?php endif; ?>

<?php do_action( 'bp_before_activity_type_tab_favorites' ); ?>

<?php if ( bp_get_total_favorite_count_for_user( bp_loggedin_user_id() ) ) : ?>
<?php /* translators: favorite activity count */ ?>
<li id="activity-favorites"><a href="<?php echo esc_attr( bp_loggedin_user_domain() . BP_ACTIVITY_SLUG . '/favorites/' ); ?>" title="<?php esc_attr_e( "The activity I've marked as a favorite.", 'commons-in-a-box' ); ?>"><?php printf( esc_html_e( 'My Favorites (%s)', 'commons-in-a-box' ), '<span>' . esc_html( bp_get_total_favorite_count_for_user( bp_loggedin_user_id() ) ) . '</span>' ); ?></a></li>
<li id="activity-favorites"><a href="<?php echo esc_attr( bp_loggedin_user_url( bp_members_get_path_chunks( [ bp_get_activity_slug(), 'favorites' ] ) ) ); ?>" title="<?php esc_attr_e( "The activity I've marked as a favorite.", 'commons-in-a-box' ); ?>"><?php printf( esc_html_e( 'My Favorites (%s)', 'commons-in-a-box' ), '<span>' . esc_html( bp_get_total_favorite_count_for_user( bp_loggedin_user_id() ) ) . '</span>' ); ?></a></li>
<?php endif; ?>

<?php do_action( 'bp_before_activity_type_tab_mentions' ); ?>

<li id="activity-mentions">
<a href="<?php echo esc_attr( bp_loggedin_user_domain() . BP_ACTIVITY_SLUG . '/mentions/' ); ?>" title="<?php esc_attr_e( 'Activity that I have been mentioned in.', 'commons-in-a-box' ); ?>">
<a href="<?php echo esc_attr( bp_loggedin_user_url( bp_members_get_path_chunks( [ bp_get_activity_slug(), 'mentions' ] ) ) ); ?>" title="<?php esc_attr_e( 'Activity that I have been mentioned in.', 'commons-in-a-box' ); ?>">
<?php /* translators: username of user whose mentions are being displayed */ ?>
<?php printf( esc_html__( '@%s Mentions', 'commons-in-a-box' ), esc_html( bp_get_loggedin_user_username() ) ); ?>
<?php if ( bp_get_total_mention_count_for_user( bp_loggedin_user_id() ) ) : ?>
Expand Down
2 changes: 1 addition & 1 deletion buddypress/activity/post-form.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<?php // phpcs:enable WordPress.Security.NonceVerification.Recommended ?>

<div id="whats-new-avatar">
<a href="<?php echo esc_attr( bp_loggedin_user_domain() ); ?>">
<a href="<?php echo esc_attr( bp_loggedin_user_url() ); ?>">
<?php bp_loggedin_user_avatar( 'width=' . BP_AVATAR_THUMB_WIDTH . '&height=' . BP_AVATAR_THUMB_HEIGHT ); ?>
</a>
</div>
Expand Down
2 changes: 1 addition & 1 deletion buddypress/docs/docs-loop.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
</td>

<td class="author-cell hidden-xs">
<a href="<?php echo esc_attr( bp_core_get_user_domain( get_the_author_meta( 'ID' ) ) ); ?>" title="<?php echo esc_attr( bp_core_get_user_displayname( get_the_author_meta( 'ID' ) ) ); ?>"><?php echo esc_html( bp_core_get_user_displayname( get_the_author_meta( 'ID' ) ) ); ?></a>
<a href="<?php echo esc_attr( bp_members_get_user_url( get_the_author_meta( 'ID' ) ) ); ?>" title="<?php echo esc_attr( bp_core_get_user_displayname( get_the_author_meta( 'ID' ) ) ); ?>"><?php echo esc_html( bp_core_get_user_displayname( get_the_author_meta( 'ID' ) ) ); ?></a>
</td>

<td class="date-cell created-date-cell hidden-sm hidden-xs">
Expand Down
15 changes: 2 additions & 13 deletions buddypress/groups/create.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,21 +153,10 @@

<div class="panel-body">

<?php if ( $group_type->get_is_portfolio() ) : ?>
<p class="ol-tooltip"><?php echo esc_html( $group_type->get_label( 'name_help_text' ) ); ?></p>
<p class="ol-tooltip"><?php echo esc_html( $group_type->get_label( 'name_help_text' ) ); ?></p>

<ul class="ol-tooltip">
<li><?php esc_html_e( 'FirstName LastName\'s Portfolio', 'commons-in-a-box' ); ?></li>
<li><?php esc_html_e( 'Jane Smith\'s Portfolio (Example)', 'commons-in-a-box' ); ?></li>
</ul>

<input class="form-control" size="80" type="text" name="group-name" id="group-name" value="<?php echo esc_attr( bp_get_new_group_name() ); ?>" required />

<?php else : ?>
<p class="ol-tooltip"><?php echo esc_html( $group_type->get_label( 'name_help_text' ) ); ?></p>
<input class="form-control" size="80" type="text" name="group-name" id="group-name" value="<?php bp_new_group_name(); ?>" required />
<input class="form-control" size="80" type="text" name="group-name" id="group-name" value="<?php echo esc_attr( bp_get_new_group_name() ); ?>" required />

<?php endif ?>
</div><!-- /.panel-body -->
</div>

Expand Down
22 changes: 15 additions & 7 deletions buddypress/groups/groups-loop.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
$current_group_type = openlab_get_current_filter( 'group-types' );
if ( ! $current_group_type ) {
$current_group_type = array_map(
function( $type ) {
function ( $type ) {
return $type->get_slug();
},
cboxol_get_group_types()
Expand Down Expand Up @@ -144,6 +144,15 @@ function( $type ) {
);
}

// Exclude private groups if not current user's profile or don't have moderate access.
$private_groups = [];
if ( bp_is_user() ) {
$private_groups = openlab_get_user_private_memberships( bp_displayed_user_id() );
if ( ! bp_is_my_profile() && ! current_user_can( 'bp_moderate' ) ) {
$group_args['exclude'] = $private_groups;
}
}

?>

<?php if ( bp_has_groups( $group_args ) ) : ?>
Expand Down Expand Up @@ -231,12 +240,7 @@ function( $type ) {
<?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<?php echo openlab_output_course_info_line( $group_id ); ?>
</div>
<?php elseif ( $group_type->get_is_portfolio() ) : ?>
<div class="info-line">
<?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<?php echo bp_core_get_userlink( openlab_get_user_id_from_portfolio_group_id( bp_get_group_id() ) ); ?>
</div>
<?php else : ?>
<?php elseif ( ! $group_type->get_is_portfolio() ) : ?>
<div class="info-line uppercase">
<?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<?php echo openlab_output_group_contact_line( $group_id ); ?>
Expand All @@ -247,6 +251,10 @@ function( $type ) {
<?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<p class="hyphenate truncate-on-the-fly" data-basevalue="105" data-basewidth="250"><?php echo bp_get_group_description_excerpt(); ?></p>
</div>

<?php if ( current_user_can( 'bp_moderate' ) && in_array( $group_id, $private_groups, true ) ) : ?>
<p class="private-membership-indicator"><span class="fa fa-eye-slash"></span> <?php esc_html_e( 'Membership hidden', 'commons-in-a-box' ); ?></p>
<?php endif; ?>
</div><!-- .item-content-wrapper -->
</div>
</div><!-- .row -->
Expand Down
10 changes: 8 additions & 2 deletions buddypress/groups/index-directory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

// Redirect to the home page if we're not on a valid group directory page.
if ( is_wp_error( $type_object ) ) {
bp_core_redirect( bp_get_root_domain() );
bp_core_redirect( bp_get_root_url() );
}

get_header();
Expand All @@ -19,7 +19,13 @@
}

$create_text = $type_object->get_can_be_cloned() ? __( 'Create / Clone', 'commons-in-a-box' ) : __( 'Create New', 'commons-in-a-box' );
$create_link = bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create/step/group-details/?group_type=' . $type_object->get_slug() . '&new=true';
$create_link = add_query_arg(
[
'group_type' => $type_object->get_slug(),
'new' => 'true',
],
bp_groups_get_create_url( [ 'group-details' ] )
);
?>

<div id="content" class="hfeed row">
Expand Down
62 changes: 48 additions & 14 deletions buddypress/groups/single/activity-list.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@

$group = groups_get_current_group();
$group_url = bp_get_group_permalink( $group );

if ( current_user_can( 'view_private_members_of_group', $group->id ) ) {
$group_private_members = [];
} else {
$group_private_members = openlab_get_private_members_of_group( $group->id );
}

?>

<?php if ( bp_is_group_home() ) { ?>
Expand All @@ -39,9 +46,16 @@
if ( ! empty( $forum_ids ) ) {
$forum_id = (int) is_array( $forum_ids ) ? $forum_ids[0] : $forum_ids;
}

$topic_args = [
'posts_per_page' => 3,
'post_parent' => $forum_id,
'author__not_in' => $group_private_members,
];

?>

<?php if ( $forum_id && bbp_has_topics( 'posts_per_page=3&post_parent=' . $forum_id ) ) : ?>
<?php if ( $forum_id && bbp_has_topics( $topic_args ) ) : ?>
<?php while ( bbp_topics() ) : ?>
<?php bbp_the_topic(); ?>

Expand All @@ -53,16 +67,24 @@
$last_reply_id = bbp_get_topic_last_reply_id( $topic_id );

// Oh, bbPress.
$last_reply = get_post( $last_reply_id );
if ( ! empty( $last_reply->post_content ) ) {
$last_topic_content = bp_create_excerpt(
wp_strip_all_tags( $last_reply->post_content ),
250,
array(
'ending' => '',
)
);
$topic_replies = get_posts(
[
'post_type' => 'reply',
'post_parent' => $topic_id,
'author__not_in' => $group_private_members,
'posts_per_page' => 1,
'orderby' => [ 'post_date' => 'DESC' ],
]
);

if ( $topic_replies ) {
$last_reply_content = $topic_replies[0]->post_content;
} else {
$topic_post = get_post( $topic_id );
$last_reply_content = $topic_post->post_content;
}

$last_reply_content = bp_create_excerpt( wp_strip_all_tags( $last_reply_content ), 250 );
?>

<?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
Expand Down Expand Up @@ -139,8 +161,18 @@
?>

<h2 class="title activity-title"><a class="no-deco" href="<?php echo esc_attr( $href ); ?>"><?php esc_html_e( 'Members', 'commons-in-a-box' ); ?><span class="fa fa-chevron-circle-right" aria-hidden="true"></span></a></h2>
<?php $member_arg = array( 'exclude_admins_mods' => false ); ?>
<?php if ( bp_group_has_members( $member_arg ) ) : ?>

<?php
$group_member_args = [
'exclude_admins_mods' => false,
];

if ( ! current_user_can( 'bp_moderate' ) ) {
$group_member_args['exclude'] = openlab_get_private_members_of_group( bp_get_current_group_id() );
}
?>

<?php if ( bp_group_has_members( $group_member_args ) ) : ?>

<ul id="member-list" class="inline-element-list">
<?php
Expand All @@ -152,7 +184,7 @@
$user_avatar = bp_core_fetch_avatar(
array(
'item_id' => $member->ID,
'object' => 'member',
'object' => 'user',
'type' => 'full',
'html' => false,
)
Expand All @@ -165,7 +197,9 @@
</li>
<?php endwhile; ?>
</ul>
<?php bp_group_member_pagination(); ?>

<?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<?php echo openlab_members_pagination_links( 'mlpage' ); ?>
<?php else : ?>

<div id="message" class="info">
Expand Down
Loading

0 comments on commit 5744a3d

Please sign in to comment.