Page 1 of 1
Forum

Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!

Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.

Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is no translation for that post!




WordPress - Cleanin...
 
Share:
Notifications
Clear all

WordPress - Cleaning up dangling user meta data (wp_usermeta)

1 Posts
1 Users
0 Likes
408 Views
 Hans
(@hans)
Famed Member Admin
Joined: 10 years ago
Posts: 2504
Topic starter  

As some may have noticed, the Dutch forum took a nose dive and crashed the Dutch website constantly.
Producing this error (posting the error, just in case someone is looking for this specific error):

Warning: Attempt to read property "roles" on bool in /home/user/public_html/wp-content/plugins/wpforo/classes/Members.php on line 1108

Fatal error: Uncaught Error: Attempt to assign property "roles" on bool in /home/user/public_html/wp-content/plugins/wpforo/classes/Members.php:1108 Stack trace: #0 /home/user/public_html/wp-content/plugins/wpforo/classes/Members.php(1166): wpforo\classes\Members->synchronize_user('2', Array) #1 /home/user/public_html/wp-content/plugins/wpforo/includes/installation.php(32): wpforo\classes\Members->synchronize_users(100) #2 /home/user/public_html/wp-content/plugins/wpforo/classes/Actions.php(20): wpforo_activation() #3 /home/user/public_html/wp-includes/class-wp-hook.php(308): wpforo\classes\Actions->wpforo\classes\{closure}('') #4 /home/user/public_html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array) #5 /home/user/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #6 /home/user/public_html/wp-content/plugins/wpforo/wpforo.php(279): do_action('wpforo_after_in...') #7 /home/user/public_html/wp-content/plugins/wpforo/wpforo.php(510): wpforo\wpforo->init_classes() #8 /home/user/public_html/wp-includes/class-wp-hook.php(308): wpforo\wpforo->init(Object(WP)) #9 /home/user/public_html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(NULL, Array) #10 /home/user/public_html/wp-includes/plugin.php(565): WP_Hook->do_action(Array) #11 /home/user/public_html/wp-includes/class-wp.php(797): do_action_ref_array('wp', Array) #12 /home/user/public_html/wp-includes/functions.php(1332): WP->main('') #13 /home/user/public_html/wp-blog-header.php(16): wp() #14 /home/user/public_html/index.php(17): require('/home/user/...') #15 {main} thrown in /home/user/public_html/wp-content/plugins/wpforo/classes/Members.php on line 1108

It appears that the forum doesn't like dangling meta data in the wp_usermeta table.

 

This is how I fixed the issue - wasn't that hard once you know where to look.

1. Made a backup of the tables wp_usermeta and wp_users. Just in case.

2. Determine what records in wp_usermeta is no longer linked to an existing user (NULL).

SELECT *
FROM wp_usermeta LEFT OUTER JOIN wp_users on wp_usermeta.user_id=wp_users.ID
WHERE wp_users.ID IS NULL

3. If all looks good, remove these rows 

DELETE wp_usermeta
FROM wp_usermeta LEFT OUTER JOIN wp_users on wp_usermeta.user_id=wp_users.ID  
WHERE wp_users.ID IS NULL

4. Test and verify if everything works as it should.

 


   
ReplyQuote

Like what you see and you'd like to help out? 

The best way to help is of course by assisting others with their questions here in the forum, but you can also help us out in other ways:

- Do your shopping at Amazon, it will not cost you anything extra but may generate a small commission for us,
- send a cup of coffee through PayPal ($5, $10, $20, or custom amount),
- become a Patreon,
- donate BitCoin (BTC), or BitCoinCash (BCH).

Share: