Skip to content

Commit 3aa1482

Browse files
committed
Merge branch 'master' into feature/magic-links
2 parents 425bb03 + 9bd4c6a commit 3aa1482

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ class BCC_Login_Visibility {
1212
public const VISIBILITY_SUBSCRIBER = 2;
1313
public const VISIBILITY_MEMBER = 3;
1414

15+
private const POST_VISIBILITY_GROUPS_IMPLEMENTATION_DATE = '2025-12-15 20:00:00';
16+
1517
// A mapping of role -> level.
1618
private $levels = array(
1719
'bcc-login-member' => self::VISIBILITY_MEMBER,
@@ -1178,10 +1180,15 @@ function post_group_tags_widget($atts) {
11781180
$post_visibility_groups = array_slice($post_visibility_groups, 0, $attributes['limit']);
11791181

11801182
$html = '';
1183+
$post_published_date = get_the_date('Y-m-d H:i:s', $post_id);
11811184

11821185
if (count($post_target_groups)) {
11831186
$html .= '<div class="bcc-target-groups">';
1184-
$html .= '<strong>' . __('Action required', 'bcc-login') . ':</strong>';
1187+
// Show label only if post was published after the post visibility groups functionality was implemented
1188+
if ($post_published_date > self::POST_VISIBILITY_GROUPS_IMPLEMENTATION_DATE) {
1189+
$html .= '<strong>' . __('Action required', 'bcc-login') . ':</strong>';
1190+
}
1191+
11851192
foreach ($post_target_groups as $role) {
11861193
$link = $attributes['link'] . '?target-groups[]=' . $role->uid;
11871194
$html .= '<a href="'. $link . '"><span class="member-overview__role-badge">' . $role->name . '</span></a>';
@@ -1191,7 +1198,11 @@ function post_group_tags_widget($atts) {
11911198

11921199
if (count($post_visibility_groups)) {
11931200
$html .= '<div class="bcc-visibility-groups">';
1194-
$html .= '<strong>' . __('For information', 'bcc-login') . ':</strong>';
1201+
// Show label only if post was published after the post visibility groups functionality was implemented
1202+
if ($post_published_date > self::POST_VISIBILITY_GROUPS_IMPLEMENTATION_DATE) {
1203+
$html .= '<strong>' . __('For information', 'bcc-login') . ':</strong>';
1204+
}
1205+
11951206
foreach ($post_visibility_groups as $role) {
11961207
$link = $attributes['link'] . '?target-groups[]=' . $role->uid;
11971208
$html .= '<a href="'. $link . '"><span class="member-overview__role-badge">' . $role->name . '</span></a>';

0 commit comments

Comments
 (0)