Drupal 7 generates a username class for the article tag, something like : class="node node-page node-published node-not-promoted node-not-sticky author-username odd clearfix".
I'd like to avoid to have the username output in the code for security reason.
I have tried the userone module, but it doesn't work for this.
I am thinking about some Jquery code, but a better way would be to avoid the username to be output at all.
I was looking in the core modules but I didn't find the php file that generates this author-[username] class.
Any help?
3 Answers
I think you can blame Omega for that one, in omega_alpha_preprocess_node()
you'll find this:
$vars['attributes_array']['class'][] = drupal_html_class('author-' . $vars['node']->name);
I think you've got two options:
- Remove that preprocess function altogether, using
hook_theme_registry_alter()
, and duplicate it intoMYTHEME_alpha_preprocess_node()
, minus the offending line. - Implement
MYTHEME_alpha_preprocess_node()
, search through the$vars['attributes_array']['class']
array, and remove it from there.
I can't see this class on clean drupal installation. check it here so class generate on your theme and their templates. check node.tpl.php and remove statement that generate this class.
One solution is to add the following code in the template.php file of the Omega subtheme and the username class for the article tag in the HTML code will not be displayed (thank you @Jance):
function [MYTHEME]_preprocess_node (&$vars){
$count = 0;
foreach($vars['attributes_array']['class'] as $class){
if(substr( $class, 0, 7 ) === "author-"){
unset($vars['attributes_array']['class'][$count]);
}
$count += 1;
}
}