WordPress.org

Ready to get started?Download WordPress

Forums

Restrict comments being posted under certain names? (6 posts)

  1. acarboni
    Member
    Posted 9 years ago #

    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?

  2. 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.

  3. Kafkaesqui

    Posted 9 years ago #

    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...

  4. Kafkaesqui

    Posted 9 years ago #

    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.");
    }

  5. Kafkaesqui

    Posted 9 years ago #

    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.");

  6. evilkirk
    Member
    Posted 8 years ago #

    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).

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.