Skip to:
Content

bbPress.org

Opened 11 years ago

Closed 8 years ago

#2452 closed defect (bug) (fixed)

Multisite dynamic user roles bug

Reported by: maniu's profile maniu Owned by: johnjamesjacoby's profile johnjamesjacoby
Milestone: 2.6 Priority: high
Severity: normal Version: 2.2
Component: API - Roles/Capabilities Keywords: has-patch
Cc:

Description

Hello

WP:3.4-3.6
bbPress: 2.3.2-2.4.1

It took me some time but i finally have figured out that dynamic roles that are getting assigned to users when "Auto Role" is disabled are being unset before bp_forum_enforce_blocked is triggered.
This results in 404 for users.

add_action( 'template_redirect', 'bbp_set_current_user_default_role', 7 ); managed to fix it for me but i am not sure what is un-setting dynamically assigned roles and if my fix does not have any down-site.

Hope my input helps.

Thanks,
Maniu

Change History (13)

#1 @johnjamesjacoby
11 years ago

Would be interested to see what exactly is causing this problem and how your solution this fixes it.

bbp_set_current_user_default_role has a did_action( 'set_current_user' ) failsafe to prevent it from running more than once under normal operating conditions, which leads me to believe something unpredicted is happening.

Related: #WP23016

#2 @johnjamesjacoby
11 years ago

  • Milestone changed from Awaiting Review to 2.5
  • Owner set to johnjamesjacoby

Moving to 2.5 to research further.

#3 @johnjamesjacoby
11 years ago

  • Milestone changed from 2.5 to 2.6

Unable to duplicate this, but my guess is there is a rogue call to switch_to_blog() occurring, that's causing the current user's roles and capabilities to be flushed. Any more insight you can provide would be really helpful.

Moving to 2.6 so we can get 2.5 out.

#4 @ubernaut
11 years ago

please ignore/delete this comment i thought i could confirm this but i was not checking it correctly. having a similar issue but not sure if tis the same one at this point.

Last edited 11 years ago by ubernaut (previous) (diff)

#5 @ubernaut
11 years ago

  • Cc ubernaut added

#6 @ubernaut
11 years ago

  • Cc ubernaut removed

#7 @johnjamesjacoby
11 years ago

  • Milestone changed from 2.6 to 2.7

Punting to 2.7.

#8 @johnjamesjacoby
10 years ago

  • Milestone changed from 2.7 to 2.8

Bumping all 2.7 to 2.8 milestone.

#9 @johnjamesjacoby
8 years ago

  • Keywords has-patch added; needs-patch removed
  • Milestone changed from 2.8 to 2.6
  • Priority changed from normal to high
  • Version changed from 2.4.1 to 2.2

#10 @johnjamesjacoby
8 years ago

In 6106:

Roles: Introduce bbp_roles_init subaction, and use this for future dynamic roles initialization.

See: #2452;

#11 @johnjamesjacoby
8 years ago

In 6107:

Roles: Modify bbp_add_forums_roles() to accept a WP_Roles object as a parameter.

This allows dynamic roles to be initialized on each call to wp_roles_init (for WordPress 4.7) rather than relying on the guesswork of blog-switching, option-sniffing, or user init'ing (none of which have ever been good indicators of roles being initialized.)

See: #2452.

#12 @johnjamesjacoby
8 years ago

In 6108:

Roles: Improve performance of bbp_get_dynamic_roles() with a local static variable.

Previously, it rebuilt the multidimensional array of role keys & strings each time it was called, which may be several depending on the page being loaded.

See: #2452.

#13 @johnjamesjacoby
8 years ago

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

Closing this, as future versions of bbPress will require WordPress 4.7 and above.

Note: See TracTickets for help on using tickets.