[wp-trac] [WordPress Trac] #20854: PHP warning caused by missing 'spam' and 'deleted' fields in a custom user table

WordPress Trac noreply at wordpress.org
Wed Sep 30 19:40:38 UTC 2020


#20854: PHP warning caused by missing 'spam' and 'deleted' fields in a custom user
table
---------------------------------------+-----------------------------------
 Reporter:  leondari                   |       Owner:  Nikolaos Raftopoulos
     Type:  defect (bug)               |      Status:  reopened
 Priority:  normal                     |   Milestone:  Future Release
Component:  Users                      |     Version:  3.3.2
 Severity:  normal                     |  Resolution:
 Keywords:  needs-testing needs-patch  |     Focuses:  multisite
---------------------------------------+-----------------------------------
Changes (by desrosj):

 * keywords:  has-patch needs-testing => needs-testing needs-patch
 * milestone:   => Future Release


Comment:

 Did some investigating on this today. Here are the steps I took:

 - Create a new database table using `CREATE TABLE custom_user_table2 AS
 SELECT * FROM wp_users`
 - Run `ALTER TABLE custom_user_table DROP COLUMN deleted, DROP COLUMN
 spam`
 - Define the `CUSTOM_USER_TABLE` constant to a value of
 `custom_user_table`.

 After taking these steps, I navigated around the Network admin and site
 admin screens, but I was unable to trigger the error described above.

 However, I was able to find a few issues:

 - If you head to the Network > Add New screen, you will be unable to
 create new users (the `Cannot add user.` error is displayed). Though, this
 is could be the preferred behavior to alert an admin of an issue, the
 message could be more informative.
 - If you head to a single site admin Users > Add New, enter a new user,
 check "Add the user without sending an email that requires their
 confirmation", click Add New User, the screen shows "User has been added
 to your site". This is not the case, no user is added to the database.
 - Follow the same steps as the previous item but don't click the
 confirmation checkbox. The user is correctly added to the `wp_signups`
 table and sent an email. When the activation link is clicked in the email,
 "An error occurred during the activation" heading is displayed with "Could
 not create user".

 It seems that there are currently no PHP notices or warnings displayed,
 but there are probably some more less than desirable outcomes somewhere in
 the code base. I think only the second one really needs to be fixed. An
 administrator should not be displayed a success notice when the user is
 not actually added.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/20854#comment:14>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list