• Hey, everyone… I’d like to make sure that no one ever posts in the comment section under my name, or the name of anyone involved with my site. That way we can be sure that if people ask a question or have a criticism, they can be sure that the response actually comes from us.

    is there any way to stop people from posting comments under our names?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator James Huff

    (@macmanx)

    Add those names to your Blacklist at Options/Discussions. It’s a backwards way of doing things, but all posts made with your names will be added to the moderation que and await administrator approval.

    You might provide a check with the internal function get_currentuserinfo() to see if the name being used (assumedly nickname) matches the name being used in the comment, but allow it if that user is logged in and posting the comment. Perhaps something like this in wp-comments-post.php:

    [removed]BAD CODE! BAD BAD CODE![/removed]

    Edit: Nope, I’m not thinking straight tonight. That ain’t gonna work…

    Here, this WILL work (again, edit it into wp-comments-post.php, somewhere after $comment_author is assigned):

    get_currentuserinfo();
    $author_nicknames = $wpdb->get_col("SELECT user_nickname FROM $wpdb->users");
    foreach($author_nicknames as $author_nickname) {
    if(($author_nickname == $comment_author) && ($user_nickname != $comment_author))
    die("Error: Sorry, but the name $comment_author is restricted to a blog author. Please try another.");
    }

    Just a little change to the code above for 1.2.x users:

    get_currentuserinfo();
    $author_nicknames = $wpdb->get_col("SELECT user_nickname FROM $wpdb->users");
    foreach($author_nicknames as $author_nickname) {
    if(($author_nickname == $author) && ($user_nickname != $author))
    die("Error: Sorry, but the name $author is restricted to a blog author. Please try another.");

    I know this is an old thread, but I found nothing closer to what I’m hoping for. I’m a new user of WP. Is there any way to effectively eliminate duplication of used nicknames? Perhaps if for users, nickname was locked to match the username, making it unique? Maybe then allow only authors to have nicks (that were then also locked out of the general pool of available names).

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Restrict comments being posted under certain names?’ is closed to new replies.