Hey all,
I would like to add content to a node based on the node author's role. For example, if the author is an administrator, I'd like to add a link at the bottom of the node. I've Googled & perused the forums for the past hour, but nothing I've found has worked so far. Any suggestions?
thanks!
Comments
*bump*
Someone must have had to do something like note that a node was composed by a website staffmember or something...
Arp Laszlo
bricksandclicks.marketing
design / theming / development / consulting
_
You could do it with a block or by editing the node.tpl.php file directly.
Something like this should work in a block:
This assumes you have a role named "administrator", you'll need to alter as necessary.
Gracias!
That's exactly what I was looking for. Is this something I could have intuited from the API documentation? (being a relative php noob, that is)
Arp Laszlo
bricksandclicks.marketing
design / theming / development / consulting
_
you're welcome ;-)
Being familiar with the api is definitely helpful-- knowing that user_load(), node_load(), and arg() exist and what they do will help you when you think of something you'd like to implement. Whenever I'm trying to figure out how to do something I go to api.drupal.org first and see if there's anything there I can use-- then I go to php.net. Nine of ten times I find something useful in the drupal api.
Got some work to do...
on learning Drupal & php better. I very much appreciate the help :-)
Arp Laszlo
bricksandclicks.marketing
design / theming / development / consulting
Worked!
I FINALLY got around to using this and it works perfectly! Of course, you would not have recommended it if it did not ;-)
I now have a related question - how can I alter this to print something if someone is *not* an administrator? IE, if someone is an admin, print X; if someone is not an admin, print Y. Thanks!
Arp Laszlo
bricksandclicks.marketing
design / theming / development / consulting
use else
Modifying the above code example you would complete the if/else evaluation so that something is done on the 'else' condition: