As more users become aware of Register Plus Redux, more and more conflicts are coming in. Each time I receive notification I download the offending plugin and try to figure out, why this author did that, each time I’m left scratching my head. I’m sure any developer looking at Redux’s code for the first time would feel the same way. There’s no comments to guide you down the yellow brick road, no rhyme or reason either, it sometimes seems.
However, today, two completely different users came to me with two completely different questions, and between the two of them, I realized I’ve been dealing with these conflicts all wrong; I should be reducing my dependency on wp_new_user_notification. I tried to do that when I first starting developing Redux, but at that time I couldn’t make much sense of WordPress’ complicated code base. My how things change over two months. I now see the error in my ways.
The following functions are executed in order when a new user registers:
func register_new_user (wp-login)
func wp_create_user (registration)
func wp_insert_user (registration)
-> action user_register (registration)
func wp_new_user_notification (pluggable)
Previously the user metadata was taken from the $_POST and entered into the database within a defined wp_new_user_notification. Because of this, our wp_new_user_notification had to handle conditions where no changes were made. This could lead to problems in the future should WordPress change their default message I would need to modify Redux to reflect that. Not something I particularly want to keep track of (not that I even know how). Upon digging around, I found the user_register hook that happens within the wp_insert_user function, which happens just before wp_new_user_notification is triggered. Now Redux more appropriately does its metadata entry within the wp_insert_user function and only defines a wp_new_user_notification function if the user has enabled any options that modify the user or admin messages. As of 3.7.0, the following options will trigger Redux to define its own wp_new_user_notification:
verify_user_email
verify_user_admin
disable_user_message_registered
disable_user_message_created
custom_user_message
disable_admin_message_registered
disable_admin_message_created
custom_admin_message
Therefore, anyone taking advantage of those options still needs to worry about conflicting plugins, but otherwise, many users should see fewer conflicts.
This is a great change for the better and it wouldn’t have been possible without feedback from Tevya Washburn and Theron Welch. Redux wouldn’t be where it is today without dedicated users willing to report their troubles, questions, and ideas. Thank you to all the users. I’ll keep making this plugin the best it can be.