Add rel author to user names in Drupal 7
Adding rel=author to your usernames to support the Google authorship feature is a snap!
<span style="color: #000000"><span style="color: #0000BB"><?php<br></span><span style="color: #007700">function </span><span style="color: #0000BB">themename_preprocess_username</span><span style="color: #007700">(&</span><span style="color: #0000BB">$vars</span><span style="color: #007700">) {<br> </span><span style="color: #FF8000">// Username is linked, use the link_attributes to inject the rel attribute<br> </span><span style="color: #007700">if (isset(</span><span style="color: #0000BB">$vars</span><span style="color: #007700">[</span><span style="color: #DD0000">'link_path'</span><span style="color: #007700">])) {<br> </span><span style="color: #0000BB">$vars</span><span style="color: #007700">[</span><span style="color: #DD0000">'link_attributes'</span><span style="color: #007700">][</span><span style="color: #DD0000">'rel'</span><span style="color: #007700">][] = </span><span style="color: #DD0000">'author'</span><span style="color: #007700">;<br> }<br> </span><span style="color: #FF8000">// Username is NOT linked, use the attributes_array to inject the rel attribute<br> </span><span style="color: #007700">else {<br> </span><span style="color: #0000BB">$vars</span><span style="color: #007700">[</span><span style="color: #DD0000">'attributes_array'</span><span style="color: #007700">][</span><span style="color: #DD0000">'rel'</span><span style="color: #007700">][] = </span><span style="color: #DD0000">'author'</span><span style="color: #007700">;<br> }<br>}<br></span><span style="color: #0000BB">?></span></span>