Block Content Per Role

This project is not covered by Drupal’s security advisory policy.

Block Content Per Role allows a block to be defined which contains content that is displayed depending on a weighted set of roles. This is useful, for example, if you want one block for a subscriber role, one for authenticated and one for anonymous.

This is difficult to do with Drupal out of the box as a users with the subscriber role will also be logged in and therefore also have the authenticated role. The Blocks system in Drupal does not allow a "complex" selection such as "Users with roles XYZ but not ABC".

Each role's content is run through Drupal's filter system. This allows you to use any of the contributed modules which provide new features. I can strongly recommend the Token Filter module (along with its dependency, Token). This module allows you to define an input format which converts tokens in the content to their value. Why is this useful? Using the Token Filter module you could (once an input format is configured) add the following to any content for an authenticated role: [token global user-name]. This block will then dynamically contain the current user's name in the block.

Block Content Per Role项目的Drush安装命令:复制到剪贴板