Skip to content

Commit

Permalink
Fixes strangerstudios#115: Resolve undefined 'link_class' warning for…
Browse files Browse the repository at this point in the history
… group join button.
  • Loading branch information
anas-ha committed Oct 23, 2024
1 parent f844f1c commit 3663c54
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions includes/restrictions.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,15 @@ function pmpro_bp_bp_user_can_create_groups( $can_create, $restricted ) {
* Hide the Join Group button if joining groups is restricted
*/
function pmpro_bp_disable_group_buttons( $button_args, $group ) {
if( ! isset( $button_args['id'] ) || ( $button_args['id'] === 'join_group' || $button_args['id'] === 'request_membership' || $button_args['id'] === 'group_membership' ) && !pmpro_bp_user_can_join_group( $group->id ) ) {
if( !pmpro_bp_user_can_join_group( $group->id )
&& (! isset( $button_args['id'] )
|| ( $button_args['id'] === 'join_group'
|| $button_args['id'] === 'request_membership'
|| $button_args['id'] === 'group_membership' ) ) ) {

global $pmpro_pages;
$button_args['link_href'] = get_permalink($pmpro_pages['pmprobp_restricted']);
$button_args['link_class'] = str_replace( 'join-group', '', $button_args['link_class'] );
$button_args['link_class'] = str_replace( 'join-group', '', $button_args['link_class'] ?? '' );
$button_args['button_element'] = 'a';
}

Expand Down

0 comments on commit 3663c54

Please sign in to comment.