Oh, and on a different note... it'd be nice if the thing actually worked and preserved all formatting between the code tags. If my instructions seemed illegible, you can find them here...
http://www.michaeltangen.com/comments_hack.txt
Oh, and on a different note... it'd be nice if the thing actually worked and preserved all formatting between the code tags. If my instructions seemed illegible, you can find them here...
http://www.michaeltangen.com/comments_hack.txt
its not code tag u use. u use backticks... the key on left of 1 key...
gotcha. didn't see the obvious right above the textarea. thnx.
Have tried this. works great! Thanks!
Very cool. I may use this if I can't get the commenters to behave...
Thanks!
Question 1: is there any way to require a valid e-mail address when folks register? I guess this would involve sending a welcome message to the address with a link to validate it. if I can't force them to use a real e-mail address, this won't be nearly as helpful.
Question 2: can I use this plugin to control the level of the user? (eg: only users level 3 and above can post comments.)
Quick comment: use the code version Michael's linked to (the txt file on his site) rather than the code in here -- it doesn't work right. On the other hand, the code on his site works beautifully. Thanks, Michael!
I got the following error after adding this code.. Any ideas about what would cause it?
Parse error: parse error in /home/johnlitt/public_html/blog/wp-comments.php on line 8
The line that is the problem is
if ((empty($user_nickname))&&(empty($user_email))) {
oops should have read the last post.. will try the linked code.
that did the trick.
Made some small changes so that the comment form isn't even shown unless the user is logged in. After the line:
<?php if ('open' == $post->comment_status) { ?>
add:
<?php if (isset ($message)) {
######### comments hack by Jamison & Michael
echo $message; // display message if they're not logged in
}
else {
?>
and change the line
<?php } else { // comments are closed ?>
to be
<?php }} else { // comments are closed ?>
Then they can't even use any little tricks to bypass the disabled form stuff. (I have a plugin for firefox that will do exactly that, and it wouldn't be hard to remove them with a regex in a spam script)
The last code posted doesn't seem to work. The forms are still there!
I tried it and had the same results. The comment form still appears.
Although well-written and -executed, this hack did not stop the "texas holdem" attack. I will try other methods...
Well, the forums really screwed up the code in my last post. So if you want the code to make the changes to the forum, and can't figure it out because of the stupidity of the forums translation, email me and I'll send it to you.
Eddie
Excellent, and I thank you, but the casino spammers have broken through. Who knows how...it's a mystery.
Back to the drawing board.
(My first post to the forum; hi, all!)
Its because you are only blocking the posting form, not what processes it. Add this to the wp-comments-post.php file, after the test for required_name_email.
# Require user to be registered and logged in before allowing posting
# 30 second hack by Brian C. Lane - http://www.libertynews.org
get_currentuserinfo();
if( empty($user_nickname) && empty($user_email) )
die( __('Error: You must be logged in before you can post') );
Ugh, pretty ugly. You should get the gist of it though, call get_currentuserinfo() and then see if nickname and email are empty.
You can also add similar code to wp-comments.php to totally remove the form:
# Require user to be registered and logged in before allowing posting
# 30 second hack by Brian C. Lane - http://www.libertynews.org
get_currentuserinfo();
if( empty($user_nickname) && empty($user_email) )
_e("Sorry, you must login before posting.");
else if ('open' == $post->comment_status) {
appreciate it guys - i just started getting attacked by the dreaded web-casino bots..far out they can be annoying.
thanks for this - works beautifully :-)
I am having a problem with this hack...
Hack works great, but I cannot seem to stay logged in... any suggestions?
So...I added the 30 second hack by Brian C Lane and nothing happened. It says "sorry, you must be logged in before posting", but still allows you to post comments.
also you can add a redirect url, so when de users logs in is redirected to de original page.
[code]
# Require user to be registered and logged in before allowing posting
# 30 second hack by Brian C. Lane - http://www.libertynews.org
get_currentuserinfo();
if( empty($user_nickname) && empty($user_email) )
_e('Sorry, you must login before posting.');
else if ('open' == $post->comment_status) {
[/code]
btw i add this around line 74 and works great ;)
fixed again xD
this time set de vars the form espect to, so it hides de form and shows de welcome back
# Require user to be registered and logged in before allowing posting
# 30 second hack by Brian C. Lane - http://www.libertynews.org
get_currentuserinfo();
if( empty($user_nickname) && empty($user_email) )
_e('Sorry, you must login before posting.');
else if ('open' == $post->comment_status) {
$comment_author_email = $user_email;
$comment_author = $user_nickname;
kada
shouting in the dark.
Hm...what do you think I'm doing wrong? I get the message but can still post comments while logged out.
Ahh...I think I had it in the wrong place. Thanks.
Hi,
Designbymichael, your file says:
Open up the wp-comments.php file and add these few lines of code after the opening <?php tag
where is that wp-comments.php file? within WordPress? I can't find one.
I am new at WP, so patience is appreciated. I'm trying to require a user to be registered and logged in to comment.
This topic has been closed to new replies.