Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter knowro

    (@knowro)

    Found the root cause. I do believe it is a TML bug, so I am sharing here.

    When a user attempts to register with a username or email address that already exists, they receive an uninformative, generic error message, copied below.

    “ERROR: Couldn’t register you… please contact the webmaster !”

    The word “webmaster” is linked to the webmaster email, so users get confused and email the webmaster to complain about not being able to register.

    Not sure why the default registration errors are being overwritten, but to fix it I added the following function to my theme’s functions.php.

    function 9609499_registration_validation( $errors, $sanitized_user_login, $user_email ) {
    	if(isset($_POST['user_login'])) {
    
    		if (username_exists( $_POST['user_login'] )) {
    
    			$errors->add( 'username_exists', '<strong>ERROR</strong>: The username '.$sanitized_user_login.' is already taken.' );
    
    		}
    	}
    
    	if(isset($_POST['user_email'])) {
    
    		if (email_exists( $_POST['user_email'] )) {
    
    			$errors->add( 'email_exists', '<strong>ERROR</strong>: The email address '.$user_email.' is already registered.' );
    
    		}
    	}
    
    	return $errors;
    
    }
    
    add_filter( 'registration_errors', '9609499_registration_validation', 10, 3 );

    Sorry all, I should have mentioned that the thread I linked to also resolved a second issue, the duplicate password fields. Here is the solution for that issue:

    The second problem with the strange behaviour in the second input password field:

    remove the password strength check in the resetpass-form.php and remove the id:

    from:
    <input autocomplete=”off” name=”pass2″ id=”pass2<?php $template->the_instance(); ?>” class=”input” size=”20″ value=”” type=”password” autocomplete=”off” />

    to:
    <input autocomplete=”off” name=”pass2″ class=”input” size=”20″ value=”” type=”password” autocomplete=”off” />

    Original Thread

    This problem was resolved in another thread. It requires hacking the TML plugin code. Here is the solution:

    Change the following line 1104 in this file: ../theme-my-login/includes/class-theme-my-login.php

    from:
    $wpdb->update( $wpdb->users, array( ‘user_activation_key’ => $hashed ), array( ‘user_login’ => $user_login ) );

    to:
    $wpdb->update( $wpdb->users, array( ‘user_activation_key’ => time().”:”.$hashed ), array( ‘user_login’ => $user_login ) );

Viewing 3 replies - 1 through 3 (of 3 total)