I need to show a block to users who have multiple roles. For example: accountant and employee. I do not want to use permissions. I need a simple solution.
is there anyone who can direct me?
You could use hook_block_view_alter() in your theme's template.php
function MYTHEME_block_view_alter(&$data, $block) {
global $user;
$roles = array('accountant', 'employee');
$required_roles = array_diff($roles, $user->roles);
if ($block->delta == 'YOUR-BLOCK-DELTA' && !empty($required_roles)) {
$data['content'] = $data['subject'] = NULL;
}
}
The array_diff() here will check that the roles the user needs to have appear in the user's roles array. If either accountant or employee do not appear in $user->roles it will set the block's content/subject to NULL and Drupal will not display it.
You can use Context module which has possibility to display content and it supports AND/OR operations for specific conditions (such as role selection).
You can show a block for specific roles on the configurationpage of the block. Navigate to admin/structure/block and click "configure" next to the block you want to set the restrections. Then scroll down to "visibility settings" and select for which roles the block must be visible: