Skip to content

Commit

Permalink
Use bp_get_group_url() where possible.
Browse files Browse the repository at this point in the history
See #458.
  • Loading branch information
boonebgorges committed Nov 15, 2024
1 parent 68bf87b commit 280757c
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions includes/frontend-bbpress.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,14 @@ public function fix_group_forum_action( $located, $template_name ) {
* @return string
*/
public function override_the_permalink_with_group_permalink( $retval = '' ) {
return bp_get_group_permalink() . 'forum/';
if ( function_exists( 'bp_get_group_url' ) ) {
return bp_get_group_url(
groups_get_current_group(),
bp_groups_get_path_chunks( [ 'forum' ] )
);
} else {
return bp_get_group_permalink() . 'forum/';
}
}

/**
Expand Down Expand Up @@ -521,7 +528,14 @@ public function fix_pending_group_topics() {
$slug = bbp_add_view_all( sprintf( '%s%d', $pending_slug_prefix, $topic_id ), true );
}

return trailingslashit( bp_get_group_permalink( groups_get_current_group() ) ) . 'forum/topic/' . $slug . $topic_hash;
if ( function_exists( 'bp_get_group_url' ) ) {
return bp_get_group_url(
groups_get_current_group(),
bp_groups_get_path_chunks( [ 'forum', 'topic', $slug ] )
) . $topic_hash;
} else {
return trailingslashit( bp_get_group_permalink( groups_get_current_group() ) ) . 'forum/topic/' . $slug . $topic_hash;
}
}, 20, 3 );

// Fix redirect link after pending topic is approved.
Expand Down

0 comments on commit 280757c

Please sign in to comment.