PHP Block for Custom Role under Drupal 6
Sometimes we need a block for just some users or a group of our websites. Under Drupal we can create a user group(role) and check current logges users role to give that user access or not. In this example I named it 'my_custom_role', but you can name it what ever you want ie: editor, moderator, privileged_customers, clients etc...
<?php
global $user;
if (in_array('my_custom_role',$user->roles)) {
return TRUE; // or print any content for my_custom_role
}
else {
return FALSE; // or print any content for other users
}
?>
Similar entries
- Drupal problem with inline style <p style=""> and <br />
- This content has been modified by another user, changes cannot be saved.
- Comparison of HDGuard, DeepFreeze, Dr-Kaiser and SteadyState
- 403 error after installing Nagios and Webmin (conflict)
- Drupal 6 vs. Joomla 1.5 (2009)
- Delete all spam node entries of a spesific user on a Drupal site with PHP
- Drupal fieldset default expanded not collapsed
- Get top 100 words / keywords from a text with PHP
- Let your visitors run Drupal cron for you
- Next generation URLs, hostname/id without www and long-keywords
- Drupal LDAP to copy Win.Server.AD groups to roles
- XP like "Show Desktop Icon" for Windows7
- How to make website popular
- Server Crash - "isc_socket_create: fcntl/reserved: Too many open files" [Howto Fix]
- Between operator in PHP
- Add to Facebook Block for Drupal
- Drupal and LDAP
- Mysql Order / Sort by before Group by
- Drupal navigation-menu can not be updated!
- How can I create Thumbnails from all Pages of a PDF File?

Comments
Post new comment