Skip to content

Changing user profile fields in Multisite causes error #3830

@dariusk

Description

@dariusk

When I change any field in a user profile, I see the following error in a Multisite installation of Newspack 6.0.2:

Fatal error:  Uncaught Error: Call to undefined function  Newspack\get_user() in  /web/dev/phpdev/docs/bkc-blogs/wp-content/plugins/newspack-plugin/includes/plugins/co-authors-plus/class-nicename-change.php:209 
Stack trace: 
#0 /web/dev/phpdev/docs/bkc-blogs/wp-includes/class-wp-hook.php(326):  Newspack\Nicename_Change::profile_update() 
#1 /web/dev/phpdev/docs/bkc-blogs/wp-includes/class-wp-hook.php(348):  WP_Hook->apply_filters() 
#2 /web/dev/phpdev/docs/bkc-blogs/wp-includes/plugin.php(517):  WP_Hook->do_action() 
#3 /web/dev/phpdev/docs/bkc-blogs/wp-includes/user.php(2509):  do_action() 
#4 /web/dev/phpdev/docs/bkc-blogs/wp-includes/user.php(2632):  wp_insert_user() 
#5 /web/dev/phpdev/docs/bkc-blogs/wp-admin/includes/user.php(233):  wp_update_user() 
#6 /web/dev/phpdev/docs/bkc-blogs/wp-admin/user-edit.php(171):  edit_user() 
#7 /web/dev/phpdev/docs/bkc-blogs/wp-admin/profile.php(18):  require_once('...') 
#8 {main}  thrown in **/web/dev/phpdev/docs/bkc-blogs/wp-content/plugins/newspack-plugin/includes/plugins/co-authors-plus/class-nicename-change.php** on line **209**`

The change is applied correctly but the error appears as a splash screen after submission!

To Reproduce
Steps to reproduce the behavior:

  1. Install Newspack 6.0.2 on a Multisite installation
  2. Log in to the dashboard
  3. Select Users -> Profile
  4. Change any field on the profile like "Website" or "First Name"
  5. Press "Update Profile"
  6. Observe the above error in a splash screen
  7. Press the browser back button
  8. Observe that the change was correctly applied

Expected behavior
I expect the profile editing page to reload with the "Profile updated." banner at the top

Notes
I'm not a Wordpress dev but I'm guessing that get_user here might be making some assumptions about how to get a user in a multisite installation?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions