Skip to:
Content

Opened 2 years ago

Closed 2 years ago

Last modified 23 months ago

#1826 closed defect (fixed)

Possible multisite issues

Reported by: tott Owned by:
Milestone: 2.1 Priority: normal
Severity: normal Version: 2.0
Component: Code Improvements Keywords:
Cc: stephen@…, djpaul@…

Description

While reviewing the plugin for multisite usage I ran into a couple of things which need some attention:

  • While favorites / subscriptions are already prefixed with a blog dependent key this functionality is still lacking for other meta keys such as _bbp_topic_count, _bbp_reply_count and _bbp_last_posted. This would mean that if you run a multisite install with a couple of forums the counts would reflect the activity of a user on all bbpress forums together. This likely is not the intended behavior.
  • The tools / repair functions in bbp-tools.php delete usermeta rows by meta key. On a multi site install with more than one bbpress this would delete the rows for all instances. If all keys would be prefixed with a blog / wpdb->prefix this could be avoided.
  • #1823 implements the possibility to map usermeta functions. In many places there are still direct db queries for inserting / deleting / querying meta data. these instances will need to be adjusted as well. For bbp-user-functions.php a simple pre_filter approach seems sufficient. the repair functions in bbp-tools.php seem to be more tricky and I would love some feedback on how this could be approached.
  • The direct db query against wpdb->users should be replaced with a count of get_users();

Change History (8)

comment:1 netweb2 years ago

  • Cc stephen@… added

comment:2 johnjamesjacoby2 years ago

  • Milestone changed from Awaiting Review to 2.1
  • Correct. The usermeta keys need to be prefixed to match their respective blog_id's.
  • Correct again.
  • bbp-tools. php will be pretty tricky, and it's mostly intended for the forum converter tool, and shouldn't really be an issue with bbPress itself.
  • Thanks for this; something easy. :)

comment:3 follow-up: gautamgupta2 years ago

Just as a note for the fourth point, the query was put there as it was a lot faster than getting all the users and counting them.

comment:4 johnjamesjacoby2 years ago

(In [3910]) Use get_users() in bbp_get_total_users() to avoid a direct database query. See #1826. Props tott.

comment:5 in reply to: ↑ 3 johnjamesjacoby2 years ago

Replying to gautamgupta:

Just as a note for the fourth point, the query was put there as it was a lot faster than getting all the users and counting them.

I swapped for get_users() so we can narrow the query down to users on that exact blog for multisite installations rather than hitting the entire users table (which may be huge.)

It also still works for single-site installs, and it avoids a direct query.

Last edited 2 years ago by johnjamesjacoby (previous) (diff)

comment:6 johnjamesjacoby2 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [3911]) User Options:

  • Introduce bbp-user-options.php to handle all user option related code.
  • Add $user_options array to main bbPress class to allow for easy, static, per-user option overrides.
  • Tweak action order for option and user_option overrides in bbp-core-hooks.php.
  • Replace all appropriate user_meta calls with user_option calls to automatically prefix keys with blog ID.
  • Update favorites, subscriptions, and topic/reply count option keys to be per-blog in multisite configurations.
  • Fixes #1826.

comment:7 DJPaul2 years ago

  • Cc djpaul@… added

comment:8 johnjamesjacoby23 months ago

(In [3945]) Capabilities & Settings:

  • Introduce bbp_admin_show_ui() function to handle fine-grained control of available settings screens and sections.
  • Fixes #1846.
  • See #1826.
Note: See TracTickets for help on using tickets.