Skip to:
Content

bbPress.org

Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#1826 closed defect (bug) (fixed)

Possible multisite issues

Reported by: tott's profile tott Owned by:
Milestone: 2.1 Priority: normal
Severity: normal Version: 2.0
Component: Tools - 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)

#1 @netweb
13 years ago

  • Cc stephen@… added

#2 @johnjamesjacoby
13 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. :)

#3 follow-up: @gautamgupta
13 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.

#4 @johnjamesjacoby
13 years ago

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

#5 in reply to: ↑ 3 @johnjamesjacoby
13 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 13 years ago by johnjamesjacoby (previous) (diff)

#6 @johnjamesjacoby
13 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.

#7 @DJPaul
13 years ago

  • Cc djpaul@… added

#8 @johnjamesjacoby
12 years 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.