Drupal: Show Stuff To Certain Role


Like this post which showed you show stuff to certain member id or member level in WordPress, you can also achieve this in drupal by using “Role”. In drupal, members are recognized as “Role” where as in WordPress it is recognized as Level.

The snippet is quite simple and easy to understand. So I’m not going to explain into details. Just make sure you have the
<?php

global $user;
if (is_array($user->roles) && in_array('role-name', $user->roles))

} ?>

Show Stuff To "role-name"!!

<?php } ?>

Replace role-name with your custom role name and you’re good to go…

Advertisements
This entry was posted in Drupal. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s