Add Group Role-Based Block Visibility Condition

Created on 29 January 2025, 6 months ago

Problem/Motivation

Currently, the Group module does not provide a way to conditionally display blocks based on Group Roles within a Group Type. This feature request proposes adding a "Group Role Condition" plugin that allows administrators to control block visibility based on the roles assigned to users in different groups.

Steps to reproduce

  • Try to configure block visibility based on Group Roles in the current Group module.
  • Notice that there is no option to restrict block visibility using group roles.

Proposed resolution

  • Provides an admin interface to configure block visibility based on Group Roles.
  • Allows users to select specific roles within different Group Types.
  • Ensures blocks are only displayed for users with matching group roles.
Feature request
Status

Active

Version

3.3

Component

Code

Created by

🇮🇳India dev.drupal.ln

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @dev.drupal.ln
  • Merge request !211Resolve #3502994 "Add group role based" → (Open) created by Unnamed author
  • Pipeline finished with Success
    6 months ago
    Total: 1400s
    #408994
  • 🇺🇸United States drupgirl

    Good feature. However, this patch results in the following error.

    The website encountered an unexpected error. Try again later.

    TypeError: htmlspecialchars(): Argument #1 ($string) must be of type string, array given in htmlspecialchars() (line 440 of core/lib/Drupal/Component/Utility/Html.php).
    Drupal\Component\Utility\Html::escape(Array) (Line: 268)
    Drupal\Component\Render\FormattableMarkup::placeholderEscape(Array) (Line: 217)
    Drupal\Component\Render\FormattableMarkup::placeholderFormat('The Tag is @block_group_roles', Array) (Line: 195)
    Drupal\Core\StringTranslation\TranslatableMarkup->render() (Line: 74)
    Drupal\asset_injector\AssetInjectorListBuilder->buildRow(Object) (Line: 272)

Production build 0.71.5 2024