Skip to content

Commit

Permalink
More use of bp_get_group_url().
Browse files Browse the repository at this point in the history
  • Loading branch information
boonebgorges committed Nov 15, 2024
1 parent 65ca4df commit 7ac2ef0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
15 changes: 10 additions & 5 deletions lib/group-funcs.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ function openlab_group_site_markup() {
</p>

<?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<ul id="change-group-site"><li><?php echo $group_site_url_out; ?> <a class="button underline confirm" href="<?php echo esc_attr( wp_nonce_url( bp_get_group_permalink( groups_get_current_group() ) . 'admin/site-details/unlink-site/', 'unlink-site' ) ); ?>" id="change-group-site-toggle"><?php esc_html_e( 'Unlink', 'commons-in-a-box' ); ?></a></li></ul>
<ul id="change-group-site"><li><?php echo $group_site_url_out; ?> <a class="button underline confirm" href="<?php echo esc_attr( wp_nonce_url( bp_get_group_manage_url( groups_get_current_group(), bp_groups_get_path_chunks( [ 'site-details', 'unlink-site' ], 'manage' ) ), 'unlink-site' ) ); ?>" id="change-group-site-toggle"><?php esc_html_e( 'Unlink', 'commons-in-a-box' ); ?></a></li></ul>
<input type="hidden" id="site-is-external" value="<?php echo intval( $site_is_external ); ?>" />

<?php if ( ! $site_is_external ) : ?>
Expand Down Expand Up @@ -1408,7 +1408,7 @@ function openlab_add_site_subnav_to_group_admin() {
'name' => _x( 'Site', 'Group admin nav item', 'commons-in-a-box' ),
'slug' => 'site-details',
'position' => 15,
'parent_url' => bp_get_group_permalink( groups_get_current_group() ) . 'admin/',
'parent_url' => bp_get_group_manage_url( groups_get_current_group() ),
'parent_slug' => bp_get_current_group_slug() . '_manage',
'screen_function' => 'openlab_group_site_settings',
'user_has_access' => bp_is_item_admin(),
Expand Down Expand Up @@ -1438,7 +1438,12 @@ function openlab_group_site_settings() {

bp_core_add_message( __( 'Site settings successfully saved.', 'commons-in-a-box' ) );

bp_core_redirect( bp_get_group_permalink( groups_get_current_group() ) . 'admin/site-details/' );
$redirect_url = bp_get_group_manage_url(
groups_get_current_group(),
bp_groups_get_path_chunks( [ 'site-details' ], 'manage' )
);

bp_core_redirect( $redirect_url );
}

/**
Expand Down Expand Up @@ -1919,7 +1924,7 @@ function openlab_show_site_posts_and_comments() {
<?php endforeach ?>

<?php if ( 'external' === $site_type && groups_is_user_admin( bp_loggedin_user_id(), bp_get_current_group_id() ) ) : ?>
<p class="description"><?php esc_html_e( 'Feed updates automatically every 10 minutes', 'commons-in-a-box' ); ?> <a class="refresh-feed" id="refresh-posts-feed" href="<?php echo esc_attr( wp_nonce_url( add_query_arg( 'refresh_feed', 'posts', bp_get_group_permalink( groups_get_current_group() ) ), 'refresh-posts-feed' ) ); ?>"><?php esc_html_e( 'Refresh now', 'commons-in-a-box' ); ?></a></p>
<p class="description"><?php esc_html_e( 'Feed updates automatically every 10 minutes', 'commons-in-a-box' ); ?> <a class="refresh-feed" id="refresh-posts-feed" href="<?php echo esc_attr( wp_nonce_url( add_query_arg( 'refresh_feed', 'posts', bp_get_group_url( groups_get_current_group() ) ), 'refresh-posts-feed' ) ); ?>"><?php esc_html_e( 'Refresh now', 'commons-in-a-box' ); ?></a></p>
<?php endif ?>
</div><!-- .recent-posts -->
</div><!-- #recent-course -->
Expand All @@ -1944,7 +1949,7 @@ function openlab_show_site_posts_and_comments() {
<?php endif ?>

<?php if ( 'external' === $site_type && groups_is_user_admin( bp_loggedin_user_id(), bp_get_current_group_id() ) ) : ?>
<p class="refresh-message description"><?php esc_html_e( 'Feed updates automatically every 10 minutes', 'commons-in-a-box' ); ?> <a class="refresh-feed" id="refresh-posts-feed" href="<?php echo esc_attr( wp_nonce_url( add_query_arg( 'refresh_feed', 'comments', bp_get_group_permalink( groups_get_current_group() ) ), 'refresh-comments-feed' ) ); ?>"><?php esc_html_e( 'Refresh now', 'commons-in-a-box' ); ?></a></p>
<p class="refresh-message description"><?php esc_html_e( 'Feed updates automatically every 10 minutes', 'commons-in-a-box' ); ?> <a class="refresh-feed" id="refresh-posts-feed" href="<?php echo esc_attr( wp_nonce_url( add_query_arg( 'refresh_feed', 'comments', bp_get_group_url( groups_get_current_group() ) ), 'refresh-comments-feed' ) ); ?>"><?php esc_html_e( 'Refresh now', 'commons-in-a-box' ); ?></a></p>
<?php endif ?>

</div><!-- .recent-posts -->
Expand Down
11 changes: 8 additions & 3 deletions lib/plugin-hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ function openlab_manage_members_email_status( $user_id = '', $group = '' ) {

$user_id = (int) $user_id;

$group_url = bp_get_group_permalink( $group ) . 'admin/manage-members/email';
$group_url = bp_get_group_manage_url( $group, bp_groups_get_path_chunks( [ 'manage-members', 'email' ], 'manage' ) );
$sub_type = ass_get_group_subscription_status( $user_id, $group->id );
echo '<h5>Email Status</h5>';
echo '<h5>' . esc_html__( 'Email Status', 'commons-in-a-box' ) . '</h5>';

echo '<ul class="group-manage-members-bpges-status">';
echo ' <li><input name="group-manage-members-bpges-status-' . esc_attr( $user_id ) . '" type="radio" ' . checked( 'no', $sub_type, false ) . ' data-url="' . esc_url( wp_nonce_url( $group_url . '/no/' . $user_id . '/', 'ass_member_email_status' ) ) . '" value="no" /> ' . esc_html__( 'No Email', 'commons-in-a-box' ) . '</li>';
Expand Down Expand Up @@ -594,7 +594,12 @@ function openlab_filter_bbpress_search_pagination_parameters( $r ) {
$search_paged = ! empty( $_GET['search_paged'] ) ? (int) $_GET['search_paged'] : 1;
// phpcs:enable WordPress.Security.NonceVerification.Recommended

$r['base'] = add_query_arg( 'bbp_search', $search_term, bp_get_group_permalink( groups_get_current_group() ) . 'forum/' ) . '&search_paged=%#%';
$r['base'] = add_query_arg(
'bbp_search',
$search_term,
bp_get_group_url( groups_get_current_group(), bp_groups_get_path_chunks( [ 'forum' ] ) )
) . '&search_paged=%#%';

$r['current'] = $search_paged;

return $r;
Expand Down

0 comments on commit 7ac2ef0

Please sign in to comment.