Wordpress prevents the administrator from being impersonated, making the Administrator comment different

Source: Internet
Author: User
By default, WordPress does not review whether the comment is published by the blogger. if someone knows the nickname and Email of the blogger, it uses this nickname and Email, you can successfully impersonate a blogger to post comments, and then cheat other visitors. I tested three methods to solve this problem.

By default, WordPress does not review whether the comment is published by the blogger. if someone knows the nickname and Email of the blogger, it uses this nickname and Email, you can successfully impersonate a blogger to post comments, and then cheat other visitors. I tested three methods to solve this problem.

First, prohibit visitors from making comments using the administrator's nickname or email.

The file used to modify the comment callback function is function. php if the topic has its own comment File, modify the topic such as: this site to modify the topic in the comments-ajax.php

WordPress 3.0

Open the wp-comments-post.php under the WordPress installation directory in a text editor and run the following code (about 70 lines ):

If (get_option ('comment _ registration') | 'private' = $ status)
Wp_die (_ ('sorry, you must be logged in to post a comment .'));

Replace:

If ('Administrator nickname '= $ comment_author | 'Administrator mailbox' = $ comment_author_email)
Wp_die ('Haha, are you kidding? ');
If (get_option ('comment _ registration') | 'private' = $ status)
Wp_die (_ ('sorry, you must be logged in to post a comment. '); WordPress 2.9.2

Open the wp-comments-post.php under the WordPress installation directory in a text editor, find and put the following code (about 63 lines ):

If (get_option ('comment _ registration') | 'private' = $ status-> post_status)
Wp_die (_ ('sorry, you must be logged in to post a comment .'));

Replace:
If ('Administrator nickname '= $ comment_author | 'Administrator mailbox' = $ comment_author_email)
Wp_die ('Haha, are you kidding? ');
If (get_option ('comment _ registration') | 'private' = $ status-> post_status)
Wp_die (_ ('sorry, you must be logged in to post a comment .'));

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.