• Hello, this plugin worked fabulous for us until recently. Each time I test it, in three different browsers, it works. However I continue to have users post as Anonymous. I can’t figure out how some users are getting by the check. Our site has a lot of comment activity and we allow users to post without logging in, so this plugin is awesome at helping multiple users not user the same nicknames. Any suggestions? Here is our site: http://wp.me/P2in2v-44B

    https://wordpress.org/plugins/impostercide/

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Ipstenu (Mika Epstein)

    (@ipstenu)

    πŸ³οΈβ€πŸŒˆ Advisor and Activist

    However I continue to have users post as Anonymous.

    Is there a user named Anonymous?

    The way it’s supposed to work, and fwiw this has not changed codewise in forever, is it looks for the username and the email. If either is found, it won’t let you post with that username or email.

    Thread Starter jemar707

    (@jemar707)

    Hello again! I never realized you replied to my message until now. oops. Yes we created a user named Anonymous to prevent this and somehow users are still bypassing the plugin and can using the name Anonymous.

    • This reply was modified 7 years, 11 months ago by jemar707.
    Plugin Author Ipstenu (Mika Epstein)

    (@ipstenu)

    πŸ³οΈβ€πŸŒˆ Advisor and Activist

    That’s okay πŸ™‚

    So I made a brand new clean site, made a user with the role of Subscriber and the name anonymous and the email anon@example.com

    Then I opened a new private window and attempted to comment as anonymous and Anonymous and Someone with the emails test@example.com and anon@example.com

    All gave the expected error.

    That means it’s most likely that you have something else preventing it from running.

    What other plugins are active?

    Thread Starter jemar707

    (@jemar707)

    I figured it out. We didn’t require users to enter a name, so if the field was left blank it would pass Impostercide check and then still display Anonymous when comment posted. Problem was we didn’t want to require email address as per the Diacussiom settings where it is both Name & Email. So I required comment_author in a preprocess function and then it works well if they try to use Anonymous.

    • This reply was modified 7 years, 11 months ago by jemar707.
    Plugin Author Ipstenu (Mika Epstein)

    (@ipstenu)

    πŸ³οΈβ€πŸŒˆ Advisor and Activist

    I JUST noticed this reply. Oh WP changes. Why you gotta be like that?

    Intersting. I disabled username and email check in Discussion settings, and I still can’t use an existing user’s name or email to leave a comment.

    Are you somehow ONLY disabling usernames and not both usernames and emails? If so, can you share that code? I may be able to make something of that…

    Thread Starter jemar707

    (@jemar707)

    Currently have the discussion settings to allow users to comment without a name and email. And, then adding this function to force name

    function require_comment_name($fields) {
     
    if ($fields['comment_author'] == '')
    wp_die('Error: please enter a valid name.');
     
    return $fields;
    }
    add_filter('preprocess_comment', 'require_comment_name');
    Plugin Author Ipstenu (Mika Epstein)

    (@ipstenu)

    πŸ³οΈβ€πŸŒˆ Advisor and Activist

    And that works okay? What was the version that didn’t work?

    Thread Starter jemar707

    (@jemar707)

    Yes the above code works to require only name. We have name placeholder set to Anonymous. If Anonymous, Impostercize triggers and works because we have an existing Anonymous user. If name is left blank it produces the error: please enter a valid name.

    Prior to that without that function, the user could leave the name field blank but the comment would appear as Anonymous, somehow bypassing Impostercize. My guess is that when the user name was left blank, the default behavior is for WP to assign the commenter_name Anonymous, but perhaps it wasn’t happening until after Impostercize checks passed because it was blank.

    Plugin Author Ipstenu (Mika Epstein)

    (@ipstenu)

    πŸ³οΈβ€πŸŒˆ Advisor and Activist

    We have name placeholder set to Anonymous.

    I think that’s the missing piece to my puzzle πŸ™‚ How did you do that?

    Thread Starter jemar707

    (@jemar707)

    //We want to force entering a user name on the comment form, but can’t use the regular Discussion Settings because it then also requires email address. So that setting is left off and this function make just Comment Author required. Need this so Impostercize will work. Uses preprocess_comment’ filter to make Name field required

    function require_comment_name($fields) {
     
    if ($fields['comment_author'] == '')
    wp_die('Error: please enter a valid name.');
     
    return $fields;
    }
    add_filter('preprocess_comment', 'require_comment_name');
    
    //new functions to add placeholders for comment form fields
    
    function my_update_comment_fields( $fields ) {
    
    	$commenter = wp_get_current_commenter();
    	$req       = get_option( 'require_name_email' );
    	$label     = $req ? '*' : ' ' . __( '(optional)', 'text-domain' );
    	$aria_req  = $req ? "aria-required='true'" : '';
    
    	$fields['author'] =
    		'<p class="comment-form-author">
    			<label for="author">' . __( "Name", "text-domain" ) . $label . '</label>
    			<input id="author" name="author" type="text" placeholder="' . esc_attr__( "Pick A Nickname", "text-domain" ) . '" value="' . esc_attr( $commenter['comment_author'] ) .
    		'" size="30" ' . $aria_req . ' />
    		</p>';
    
    /* We don't want email to appear on comment form
    	$fields['email'] =
    		'<p class="comment-form-email">
    			<label for="email">' . __( "Email", "text-domain" ) . $label . '</label>
    			<input id="email" name="email" type="email" placeholder="' . esc_attr__( "name@email.com", "text-domain" ) . '" value="' . esc_attr( $commenter['comment_author_email'] ) .
    		'" size="30" ' . $aria_req . ' />
    		</p>';
    */
    
    /* We don't want URL to appear on comment form
    	$fields['url'] =
    		'<p class="comment-form-url">
    			<label for="url">' . __( "Website", "text-domain" ) . '</label>
    			<input id="url" name="url" type="url"  placeholder="' . esc_attr__( "http://google.com", "text-domain" ) . '" value="' . esc_attr( $commenter['comment_author_url'] ) .
    		'" size="30" />
    			</p>';
    */
    
    	return $fields;
    }
    add_filter( 'comment_form_default_fields', 'my_update_comment_fields' );
    Thread Starter jemar707

    (@jemar707)

    I only know enough to be dangerous with this stuff, I patched that together from another source, not sure where.

    Plugin Author Ipstenu (Mika Epstein)

    (@ipstenu)

    πŸ³οΈβ€πŸŒˆ Advisor and Activist

    I wrapped your code with code tags πŸ™‚ I’ll play with this and see if I can figure out what’s going on. I think it’s what we call a race condition, where two things are happening at the same time.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Not working for some users’ is closed to new replies.