I'm looking for the simplest solution to allow a custom CSS page to load per role. I have to the CSS pages done, but just need to load them and ensure they are only loaded based on user role.
I'm guessing it should be about three lines of PHP to go at the bottom of the template.php, but not sure what the code should be. Any advice?
Thanks.
With relation to the answer and my comment below, tried the beneath code unsuccessfully using the bamboo theme
function bamboo_preprocess_page(&$variables) {
global $user;
if (in_array('testtest', $user->roles)) {
drupal_add_css(drupal_get_path('theme', 'bamboo') . '/roleedits.css');
}
}
If my code wrong or is it a problem with the theme?
(for the record I did create a role called testtest.)
The error I get is:
Fatal error: Cannot redeclare bamboo_preprocess_page() (previously declared in E:\Test\sites\all\themes\bamboo\template.php:231) in E:\Test\sites\all\themes\bamboo\template.php on line 385
NOTE: Both the solution below work. I just accepted the one I used. However both have been tested and work fine, just the second solution offered me more flexibility to call roles again in future.