1 pmakulski May 20, 2006 01:12
3 blueyed May 20, 2006 03:48
The links which EdB posted are rather workarounds: they try to validate the user.
If you want to disable comments for anonymous users, you will have to add
is_logged_in()
checks to some files:
At the beginning (after requiring "_main.php") of comment_post.php and trackback.php (in /htsrv) add this:
if( ! is_logged_in() )
{ // HACK: Comments are disabled for anonymous users.
die( 'Comments are disabled for anonymous users.' );
}
and in /b2evocore/_class_item.php add this at the beginning of "function can_comment":
if( ! is_logged_in() )
{ // HACK: Comments are disabled for anonymous users.
echo $before_error;
echo 'Comments are disabled for anonymous visitors';
echo $after_error;
return false;
}
This is for b2evo v0.9.x, but should also apply to v1.6+.
Because of this request, I've just also added a hook into Item::can_comment() and added exactly this feature to the "Basic Antispam Plugin".
4 pmakulski May 20, 2006 18:13
I'll gve that a try.
5 mivaho May 23, 2006 21:39
Hi Blueyed,
We're also looking for a way to allow commenting only to authenticated users to prevent spamming.
Trying to put the code in to the files I found that in 1.8alpha (CVS) there is no feedback.php in /htsrv there are _feedback.php files in the skins, do we need to put the code in there?
And I couldn't find the "_class_item.php" file.
You say:
blueyed wrote:
Because of this request, I've just also added a hook into Item::can_comment() and added exactly this feature to the "Basic Antispam Plugin".
Is this for 0.9.x? I couldn't find a basic antispam plugin for 1.8+
Allowing only registered users to comment is a verry basic feature in CMS's like mambo and Joomla! I tought it would be a basic feature of b2e also but couldn't find it. Now I understand it's not. :D
Thnx,
Michel
6 blueyed May 23, 2006 23:18
The "Basic Antispam Plugin" should be in CVS since a few weeks.
See "Settings -> Plugins -> Available Plugins" and install it from there.
7 pmakulski May 24, 2006 05:06
blueyed wrote:
At the beginning (after requiring "_main.php") of comment_post.php and feedback.php (in /htsrv) add this:
if( ! is_logged_in() ) { // HACK: Comments are disabled for anonymous users. die( 'Comments are disabled for anonymous users.' ); }
Alrighty. That seems to have worked.
Super. Thanks.
One thing though ...
I couldn't find function.php in htserv.
I did find _function.php in skin, but this didn't look like the right thingie.
So, I only made the two changes: comment_post.php and the core change.
So far, so good. No crash; No comments for anon users!
8 blueyed May 24, 2006 22:01
I couldn't find function.php in htserv.
I did find _function.php in skin, but this didn't look like the right thingie.
You mean feedback.php? :)
I've meant trackback.php and will change the post above.
9 mivaho May 24, 2006 22:27
Hi Blueyed,
blueyed wrote:
The "Basic Antispam Plugin" should be in CVS since a few weeks.
See "Settings -> Plugins -> Available Plugins" and install it from there.
Yep stupid me :D
Updated to latest CVS and installed the plugin and it was there.
Will test it.
Thnx again,
Michel
10 mivaho May 24, 2006 22:50
Hi,
Installed the antispam plugin you mentioned.
I'm a complete moron I know, but do I still have to do the hack?
Or should I do something to the skin?
Because after checking the box that anonymous users can't comment it is still possible.
Please forgive my ignorance :D
Thnx,
Michel
11 blueyed May 24, 2006 22:54
Have you checked "Disable anonymous feedback" in the basic antispam plugin settings?
Anyway, I've just committed a change to _item.class.php, which is required for this to work properly (but probably does not cause it to fail completely). You might want to update from CVS (_item.class.php should be revision 1.46).
12 pmakulski May 26, 2006 01:00
blueyed wrote:
I couldn't find function.php in htserv.
I did find _function.php in skin, but this didn't look like the right thingie.
You mean feedback.php? :)
I've meant trackback.php and will change the post above.
Doh! :oops: I assume that's what I meant. I'll do the trackback.php.
Thanks for the correction.
There is no 'official' option for that. Comments are either Open or Closed or (what's the other one....?) something like "Don't Exist At All". There are hacks that will give you what you want though. http://forums.b2evolution.net/viewtopic.php?t=5343 is one way. http://forums.b2evolution.net/viewtopic.php?t=7471 is another but I've got some problems with the second hack. Gotta figure it out and fix it, but it might work for you.