• Resolved ZeroGravity

    (@zerogravity)


    The site was put together back in February but the launch was put on hold because of COVID. At this time we were able to register users via the registration form. I have updated WP and plugins over this period.

    We are launching tomorrow and I was running through everything testing the notifications are going to the correct email addresses and discovered the Registration form is no longer working.

    Several of these errors showed referencing different line numbers.
    Notice: Trying to access array offset on value of type null in /home/rckhorse/public_html/wp-content/plugins/wp-members/includes/api/api-users.php on line 567

    I downgraded PHP from 7.4 to 7.3 and the errors went away but the form still doesn’t work. I have manually downgraded serveral versions of the plugin and this didn’t help either. No users appear on the user page in the admin and the notification email is not being sent. I checked the log in cPanel and no emails have been sent.

    Desperately need help as everything goes live in a couple of hours. ??

    Thanks!

    • This topic was modified 4 years, 4 months ago by ZeroGravity. Reason: Extra Info

    The page I need help with: [log in to see the link]

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

    (@cbutlerjr)

    A quick mention of the error is that it’s actually a “notice”. Not sure why you got those, but PHP 7.4 is more strict on some standards than previous versions and that could be why. The plugin is tested and developed on PHP 7.4, and I haven’t reproduced anything like that, but it could be something configuration-wise. However, regardless of any of that, you shouldn’t have PHP’s error reporting turned on on a production site. If you disable that in your PHP settings (or turn off WP’s debug mode, if that’s enabled), then notices like this are not displayed. And since it’s a notice and not an error, it’s ignored.

    I looked at the page you indicated. It looks fine. I tested the form and it appeared to work OK.

    If there’s an issue with emails, there is some troubleshooting information here:
    https://rocketgeek.com/plugins/wp-members/docs/faqs/#email

    Thread Starter ZeroGravity

    (@zerogravity)

    Hi Chad (@cbutlerjr),

    Thanks for the reply.

    I turned on the debug mode to test what was might be happening with the form. I turned it off before we moved the site live.

    On the front end the form appears to work. It submits and displays the correct message but nothing happens on the back end. No user is created and none of the notification emails are sent.

    The contact forms on the website are sending without issues. So I don’t believe it would be a sending issue.

    Would I be correct in assuming the emails are generated and sent after the user is created and if there is an error creating the user then the emails may not be generated?

    I deactivated all the other plugins and tried but the result is the same.

    Plugin Author Chad Butler

    (@cbutlerjr)

    If the user is not being created, then whatever is failing is happening during the registration process is likely a “fatal” error (which would halt further execution). That would lead to no email being sent.

    However, the process on the screen completes, so that seems like it would be an unlikely scenario. So you probably need to step in and do some detective work to determine where there’s a breakdown.

    You’ll need to start with deactivating other plugins to see if you can isolate a conflict. If you can, then at least you know where to look for possible compatibility issues.

    The contact forms on the website are sending without issues. So I don’t believe it would be a sending issue.

    Actually, the way email works, you can’t make that assumption. Each message type has to be evaluated on it’s own. Your sending server or the receiver can reject anything that they think looks like spam or doesn’t meet rule-based criteria. So just because one type of message is sent and received doesn’t mean all will be.

    Rather than open a huge discussion of email and its potential issues, especially with the way wp_mail() works, it’s easier to just say that the best thing you can do for email is to configure your setup to make sure you use an authenticated SMTP account to send your email rather than the web server. There are plenty of good plugins for this, or there is my preferred method, which has been lobbied to be a standard part of the wp-config.php:

    https://www.butlerblog.com/2013/12/12/easy-smtp-email-wordpress-wp_mail/

    Plugin Author Chad Butler

    (@cbutlerjr)

    Side note to the testing I mentioned above – you do need to run in debug mode when testing so you can determine if there are any php errors generated. Ideally, you’d enabling logging of php errors so that you can check the error log if something doesn’t actually occur on-screen.

    Thread Starter ZeroGravity

    (@zerogravity)

    Problem solved.

    We are using the wpmem_register_data action to modify the user_nicename, display_name and nickname when creating a user. Either $fields had been removed from the return at the end of the function or somehow miraculously it worked back in February without it.

    Thanks for all your help Chad!

    Here is the code we are using in case anyone else is looking to do the same.

    // Change names so they aren't the same as the username
    add_action( 'wpmem_register_data', 'zgwd_obscure_names', 10, 2 );
    function zgwd_obscure_names( $fields, $toggle ) {
      
    	// This is a new registration
    	if ( 'new' == $toggle ) {
    		$fields['user_nicename'] = $fields['first_name'] . ' ' . $fields['last_name'];
    		$fields['display_name'] = $fields['first_name'] . ' ' . $fields['last_name'] . ' - ' . $fields['company_name'];
    		$fields['nickname'] = $fields['first_name'] . ' - ' . $fields['company_name'];
    	}
    	
    	return $fields;
    }
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Registration Form not registering user or sending notification emails’ is closed to new replies.