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.
By spade on
Hello,
I only want authenticated users to be able to read and post comments. Unauthorized user should not see that message, because I only want invited users to be able to login and contribute.
How would I remove this link for unauthorized users and still have the comment link for registered users who are logged in?
Kind regards,
Frank
Comments
You can hide it with CSS
I believe dropping this into your style.css file will do the trick:
It's possible the div class class has changed in Drupal 6, but that did the trick on a 5.x site of ours. But regardless, all you'd need to do is log out, view the source of a page that's showing the "Login/Register" message, and figure out what span or class you need to set to display:none.
Thanks tks,
Thanks tks,
sounds good, but doesn't get me there.
First there is no style.css in my installation. I tried placing this in some other css files but it didn't work.
I found this line in the source:
<ul class="links inline"><li class="comment_forbidden first last"><span><a href="/user/login?destination=comment/reply/1%2523comment-form">Login</a> or <a href="/user/register?destination=comment/reply/1%2523comment-form">register</a> to write comments</span></li>
These are all the css files in the head, none contains the class comment_forbidden:
Sorry for being so unenlightened.
Kind regards,
Frank
Hi Frank. The existing CSS
Hi Frank.
The existing CSS files probably wouldn't have anything in there for .comment_forbidden, unless the theme was applying some special style to that list item already. You'd be adding in the reference.
I'm not familiar with the theme that you're using, but my best guess would be to update either
/sites/all/themes/yaml/css/screen/content.css
or
/sites/all/themes/yaml/css/patches/patch_drupal.css
My knowledge of CSS is pretty thin, so take this with a grain of salt -- but sometimes it's necessary to drill down to a very specific level to override any other settings higher up in the CSS files. You found the right li class in the code you pasted above; you might try getting more specific like this:
Stick that at the very bottom of the patch_drupal.css file, and see what happens. Or send/post a link to the site you're working on, and I'm happy to take a look.
ALSO: Be sure to 1) clear your browser's cache/temporary files/whatever, and 2) make sure Drupal's site caching is turned off while you're testing. I can't even count the number of times I've been stumped by a problem, only to find that I HAD fixed it, but still had a cached version of the CSS being used!
You saved me some hours of sleep ;-)
Hi Troy,
thanks for your tipp and the hint with clearing the cach, it works now.
Keep up the good work.
Kind regards,
Frank
It works in IE but not in Firefox
Oops, I made a late discovery:
Your tip works well in IE7, but not in FF2. Any idea what may be the reason?
Kind regards,
Frank
Well, you can go for the
Well, you can go for the captcha verification, where you can match wrong answer.
For example: 12 + 13 = 30