Skip to content

Commit

Permalink
Ignore 'can_be_granted' feature in openlab-badges.
Browse files Browse the repository at this point in the history
See #3479.
  • Loading branch information
boonebgorges committed Dec 30, 2024
1 parent aad553d commit 3510fa1
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions wp-content/themes/openlab/lib/group-funcs.php
Original file line number Diff line number Diff line change
Expand Up @@ -1985,6 +1985,26 @@ function openlab_group_request_user_link() {
);
}

/**
* Ignore 'can_be_granted' feature in OpenLab Badges.
*/
add_action(
'pre_get_terms',
function( $term_query ) {
$taxonomy = (array) $term_query->query_vars['taxonomy'] ?? [];
if ( ! in_array( 'openlab_badge', $taxonomy, true ) ) {
return;
}

// Don't allow the 'can_be_granted' meta query clause.
$meta_query = (array) $term_query->query_vars['meta_query'] ?? [];
if ( isset( $meta_query['grantable'] ) ) {
unset( $meta_query['grantable'] );
$term_query->query_vars['meta_query'] = $meta_query;
}
}
);

/**
* Adds a Badges link under group avatars on single group headers.
*/
Expand Down

0 comments on commit 3510fa1

Please sign in to comment.