Search code examples
cssdrupaldrupal-comments

drupal..how to modify the style of the login or register shown in content


I have a wierd problem that I can't seem to find the solution, probably it is very simple. the text is this: Login or register to add comments

    <span>
<a href="/user/login?destination=node%2F1179%23comment-form">Login</a> or 
<a href="/user/register?destination=node%2F1179%23comment-form">register</a>
 to add comments
</span>

I want to customize this and add some classes for the links in order to personalize it


Solution

  • Override theme_comment_post_forbidden. To do that, in your theme (say it's called "example"), copy the code in the function that Drupal provides and make the appropriate changes.

    function example_comment_post_forbidden() {
    ...
    return t('<a class="login-link" href="@login">Login</a> or <a class="register-link"
    href="@register">register</a> to post comments', array('@login' => url('user/login', 
    array('query' => $destination)), '@register' => url('user/register', array('query' => 
    $destination))));
    ...
    }
    

    Notice that I added a class attribute to each a element. Again, make sure you copy all the code and make changes only where you need to. Clear the cache to make sure Drupal registers the theme function.