Hi,
After updating to the latest version of wpDiscuz (updated on my site two days ago), I encountered a fatal PHP error:
Fatal error: Uncaught TypeError: trim(): Argument #1 ($string) must be of type string, WP_User given in /wp-includes/class-wp-user.php:218
After some debugging, I tracked it down to this line in your plugin:
get_user_by("email", $idOrEmail); // in WpdiscuzHelper.php, line 1116
In some cases, $idOrEmail is actually a WP_User object, which causes get_user_by() to fail since it expects a string, not an object.
🔧 Temporary Fix
I modified the getUserNameAndEmail() function inside class.WpdiscuzHelper.php to properly handle the case where $idOrEmail is a WP_User object:
} elseif ($idOrEmail instanceof WP_User) {
$nameAndEmail = [
"name" => $idOrEmail->display_name,
"email" => $idOrEmail->user_email,
"isUser" => 1,
"user_id" => $idOrEmail->ID,
];
}
This resolved the issue completely.
Just wanted to report this so it can be patched in the next update. Thanks for your great work and support!
Hi,
We'll check and get back to you ASAP.
In case you want to say thank you! 🙂
We'd really appreciate if you leave a good review on the plugin page.
This is the best way to say thank you to this project and the support team.
I have the same fatal error on the site when trying to create or edit a post.
Same issue here, fatal error when attempting to create or edit a post. Is there a way to move back to v7.6.30 in the meantime?
Thanks @omriamos for the fix, confirming it works!
The issue is fixed, please update the wpDiscuz to the latest version (v. 7.6.32), clear all kinds of caches and check again.
In case you want to say thank you! 🙂
We'd really appreciate if you leave a good review on the plugin page.
This is the best way to say thank you to this project and the support team.
@asti updated, everything works.
Thank you for your promptness.


