• Resolved widecast

    (@widecast)


    Hello Chad,

    I originally posted this to the 3.2.0 sticky thread, but now posting as new thread as that may be more appropriate.

    I’ve been using WP-Members together with Theme My Login plugin without any issues.

    It appears that the latest update to 3.2.0 is causing some sort of conflict with new user registrations on the TML registration page.

    The following error is triggered, “Sorry, Username is a required field”, even though the username is being entered. The error goes away when I deactivate WP-Members.

    Any ideas? Thanks!

    David

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Chad Butler

    (@cbutlerjr)

    I originally posted this to the 3.2.0 sticky thread, but now posting as new thread as that may be more appropriate.

    Yes, opening a new thread is better, since the other thread is more of announcements. I’m not monitoring it. Specific issues are better reported as a new thread.

    Your issue is part of a group of fixes that will be released as 3.2.1. It stems from the addition of the username field to the WP-Members fields array. This change was done to make it easier for users to (1) move the location of the field in the form (rather than always being at the top), and (2) to be able to edit the field label like other fields. (Previously, these two things were possible but only with a filter. Now it can be done via the admin interface.)

    This addition affects a few different places the form fields get retrieved, one of them being form validation for the native WP registration process, which is what you are essentially using.

    The plugin has a process for excluding fields from the fields array based on what process is retrieving them. With this update, in the case of native WP registration, the username field was excluded from the form itself, but somehow wasn’t removed for when the form is validated.

    3.2.1 corrects this and a few other minor problems. I need to do some additional testing before officially releasing it, but you can currently get it via github if you want to use it and test it: https://github.com/butlerblog/wp-members The changelog in the readme.txt file will indicate what other changes are in the update.

    Thread Starter widecast

    (@widecast)

    Thank you for the explanation. That makes sense.

    I just tested 3.2.1 from GitHub and it does in fact appear the resolve the validation issue on the native WP registration form.

    Plugin Author Chad Butler

    (@cbutlerjr)

    No problem – thanks for the feedback on the fix. 3.2.1 has been officially released now (that fix is included).

    Hi Chad,

    Thanks for the great plugin!

    I was on 3.2.2.1 but still receiving the, “Sorry, username is a required field” error on attempted registration.
    I worked out the cause. Leaving the fix here in case anyone has the same issue; at least they can benefit from the time I spent debugging it.

    I was using the ‘wpmem_register_form_rows‘ filter to update the username field HTML in the registration form.

    I was using:

    add_filter( 'wpmem_register_form_rows', 'wpMembersChangeRegistrationRows', 10, 2);
    
    function wpMembersChangeRegistrationRows( $rows, $tag ) {
        if ($tag == 'new') {
    		$rows['username'] = array(
    			'order' => 3,
    			'row_before' => '',
    			'row_after' => '',
    			'field_before' => '',
    			'field_after' => '',
    			'field' => '<input name="user_login" type="text" id="user_login" value="" class="textbox" required="">',
    			'label' => '<label for="user_login" class="text">Username<span class="req">*</span></label>',
    			'type' => 'text',
    		);
    	}
    
    	return $rows;
    }

    I outputted $rows['username'] in this function and saw that the input now uses ‘username’ for the input name instead of ‘user_login’.

    Updating this field name from ‘user_login’ to ‘username’ fixed it for me.

    I’m guessing others may come across this if they are also overriding the username field and label with this filter.

    Also, I still get the Uncaught TypeError: $(...).select2 is not a function error in the main settings page: Settings > WP-Members Options.

    I’m using the updated fix from this commit:
    https://github.com/butlerblog/wp-members/commit/4d3bd820da356b027a88f87b1617a76057361f74
    I installed a new WordPress site, and only added WP-Members and this JS error still occurs for me.

    Cheers,
    Nathan

    • This reply was modified 6 years, 7 months ago by iugonathan.
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘WP-Members with Theme My Login’ is closed to new replies.