Skip to content

Commit 14542f0

Browse files
committed
Merge branch 'master' into hotfix/link-to-target-groups-filtering
2 parents be75119 + 9bac8d5 commit 14542f0

3 files changed

Lines changed: 25 additions & 8 deletions

File tree

plugins/bcc-login/bcc-login.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* Plugin Name: BCC Login
55
* Description: Integration to BCC's Login System.
6-
* Version: 1.1.364
6+
* Version: 1.1.369
77
* Author: BCC IT
88
* License: GPL2
99
*/
@@ -31,7 +31,7 @@ class BCC_Login {
3131
* The plugin instance.
3232
*/
3333
private static $instance = null;
34-
private $plugin_version = "1.1.364";
34+
private $plugin_version = "1.1.369";
3535
private $plugin;
3636
private $plugin_slug;
3737
private $plugin_name = "BCC Login";

plugins/bcc-login/includes/class-bcc-login-visibility.php

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,23 +1048,40 @@ function post_group_tags_widget($atts) {
10481048
$post_id = get_the_ID();
10491049
if (!$post_id) return false;
10501050

1051-
$attributes = shortcode_atts(array('limit' => 100, 'with_link' => true), $atts);
1051+
$attributes = shortcode_atts(
1052+
array(
1053+
'limit' => 100,
1054+
'with_link' => true,
1055+
'only_user_groups' => false
1056+
),
1057+
$atts
1058+
);
1059+
1060+
// Convert to actual booleans
1061+
$only_user_groups = filter_var($attributes['only_user_groups'], FILTER_VALIDATE_BOOLEAN);
1062+
$with_link = filter_var($attributes['with_link'], FILTER_VALIDATE_BOOLEAN);
10521063

10531064
$post_groups = get_post_meta($post_id, 'bcc_groups', false);
10541065
$filtering_groups = $this->_settings->filtering_groups;
1055-
$shown_groups = array_slice(array_intersect($post_groups, $filtering_groups), 0, $attributes['limit']);
1066+
$shown_groups = array_intersect($post_groups, $filtering_groups);
1067+
1068+
if ($only_user_groups) {
1069+
$user_groups = $this->get_current_user_groups();
1070+
$shown_groups = array_intersect($shown_groups, $user_groups);
1071+
}
1072+
1073+
$shown_groups = array_slice($shown_groups, 0, $attributes['limit']);
10561074

10571075
$html = '';
10581076

10591077
foreach ($shown_groups as $group) {
1060-
$link = $attributes['with_link'] == true ? '/informasjon/?target-groups[]='. $group : 'javascript:void(0)';
1078+
$link = $with_link ? '/informasjon/?target-groups[]='. $group : 'javascript:void(0)';
10611079
$html .= '<a class="bcc-badge bcc-badge-sm bcc-badge-custom" href="'. $link . '"><i class="material-symbols-rounded">info</i><span>' . $this->get_group_name($group) . '</span></a>';
10621080
}
10631081

10641082
return $html;
10651083
}
10661084

1067-
10681085
function tags_for_queried_target_groups() {
10691086
$html = '';
10701087

plugins/bcc-login/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"private": true,
33
"name": "bcc-login",
4-
"version": "1.1.364",
4+
"version": "1.1.369",
55
"slug": "bcc-login",
66
"author": "<a href='https://github.com/bcc-code'>BCC Code</a>",
77
"author_profile": "https://github.com/bcc-code",
88
"requires": "3.0",
99
"tested": "5.8",
1010
"requires_php": "5.3",
11-
"last_updated": "2025-09-16 11:22:27",
11+
"last_updated": "2025-10-27 12:58:02",
1212
"sections": {
1313
"description": "BCC Login",
1414
"installation": "Add OIDC_CLIENT_ID and OIDC_CLIENT_SECRET as environment variables or constants in wp-config.php, and active plugin",

0 commit comments

Comments
 (0)