Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
In template.php:
// Add a class to allow styling based on the node author.
$vars['attributes_array']['class'][] = drupal_html_class('author-' . $vars['node']->name);
using the user name here isn't the most robust information about the user in the case for example of a name change. It is also not friendly to methods where the obfuscating the username is wanted.
Using the user id seems like a more robust approach here, since the uid does not change unless the username.
Comment | File | Size | Author |
---|---|---|---|
#1 | 1484088_1_author-uid.patch | 589 bytes | scor |
Comments
Comment #1
scor CreditAttribution: scor commentedComment #2
Cellar Door CreditAttribution: Cellar Door commentedWhat do you think himerus -> 3.2?
Comment #3
himerus CreditAttribution: himerus commentedThis will go in 3.2, yes.
Comment #4
himerus CreditAttribution: himerus commentedcommited.