I created file node--my_content_type.tpl.php, where I'd like to print the username as string. I tried the following code, but unfortunately it doesn't work. How can I do it?
<?php print $name; ?>
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.Sign up to join this community
Usernames are stored in the
global $user; print_r($user);
If you mean the fields in a node, those would be in the node object (
I highly recommend looking at the output of the above. Get familiar with both the user object and the node object and everything will make a lot more sense.