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

TKS’s picture

I believe dropping this into your style.css file will do the trick:

.comment_forbidden {
	display: none;
}

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.

spade’s picture

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:

<link type="text/css" rel="stylesheet" media="all" href="/modules/node/node.css?1" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/poll/poll.css?1" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/system/defaults.css?1" />

<link type="text/css" rel="stylesheet" media="all" href="/modules/system/system.css?1" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/system/system-menus.css?1" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/user/user.css?1" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/modules/fontsize/fontsize.css?1" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/forum/forum.css?1" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/yaml/yaml/core/base.css?1" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/yaml/css/screen/basemod.css?1" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/yaml/css/screen/basemod_2col_13.css?1" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/yaml/css/screen/basemod_drupal.css?1" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/yaml/css/screen/basemod_gfxborder.css?1" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/yaml/css/navigation/nav_slidingdoor.css?1" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/yaml/css/navigation/nav_vlist_drupal.css?1" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/yaml/css/screen/content.css?1" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/yaml/yaml/core/print_base.css?1" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/yaml/css/print/print_003.css?1" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/yaml/css/print/print_drupal.css?1" />
<style type="text/css">#col1 { width: 26% }#col3 { width: auto; margin: 0 0 0 26% }</style>

<style type="text/css">#page_margins { width: 665px; min-width: inherit; max-width: none }</style>
<!--[if lte IE 7]>
<style type="text/css" media="all">
@import "/sites/all/themes/yaml/yaml/core/iehacks.css";
@import "/sites/all/themes/yaml/css/patches/patch_nav_vlist_drupal.css";
@import "/sites/all/themes/yaml/css/patches/patch_2col_13.css";
@import "/sites/all/themes/yaml/css/patches/patch_drupal.css";

Sorry for being so unenlightened.

Kind regards,

Frank

TKS’s picture

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:

ul.links li.comment_forbidden {
display: none;
}

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!

spade’s picture

Hi Troy,

thanks for your tipp and the hint with clearing the cach, it works now.

Keep up the good work.

Kind regards,

Frank

spade’s picture

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

NextTime629’s picture

Well, you can go for the captcha verification, where you can match wrong answer.

For example: 12 + 13 = 30