Favorites & Subscriptions
bbPress 2.6 changes the way favorites & subscriptions are stored in the database. This page explains why, and what steps you may need to take if the upgrade does not automatically trigger for you.
If an upgrade failed before completing, that’s OK. You can safely rerun the upgrade from
Tools > Forums at anytime without destroying or duplicating data.
For small forums with less than 10,000 users, bbPress will try to automatically migrate your favorites & subscriptions. If your forum has more than 10,000 users, bbPress knows it may take more resources than are available, and will skip the upgrade.
All versions of bbPress previous to 2.6 stored favorites & subscriptions in
wp_usermeta with 1 value for each user on each site. On multisite installations with many users, this results in inefficient database queries and many globally available rows that are never used in a global way.
bbPress 2.6 takes the approach of storing each individual favorite & subscription in the
wp_postmeta database table. This allows for a few different improvements
- It’s easier to query both ways – Subscriptions per User & Site, and Subscriptions per Topic
- Fewer rows in
wp_usermetaresult in performance improvements unilaterally in WordPress & bbPress
- Gathering user email addresses to send subscriptions to is now a very simple & fast database query
If you’re one of the lucky few who need to manually upgrade your forums because you have more than 10,000 users, there are 3 bbPress functions in
bbpress/includes/admin/tools.php that you will want to review:
These 3 functions do the following:
meta_keyfor all users who have favorited or subscribed
- Loop through each row, and split it into post IDs
- Loop through each post ID, and add the user ID to it’s meta-data with the appropriate
- If the number of items added matches the original, the pre-2.6
You may want to do the following:
- Increase the amount of memory made available to PHP, and your web-server software (Apache, Nginx, etc…)
- Increase the physical memory of the server running these scripts
- Increase the timeout length to allow these scripts a few minutes to run as-is
- Modify the original query to limit user ID results to loop through. (Usually 1000 users at a time is a good number.)
- Comment-out calls to
delete_metadata_by_mid()to dry-run the tests
For added context, these are the same scripts & techniques the bbPress team employed to upgrade BuddyPress.org, bbPress.org, WordCamp.org, and WordPress.org. They work, and they work very well, but we understand moving data around is scary, and want you to feel prepared & comfortable with what’s happening under the hood.