Skip to:
Content

bbPress.org

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#2042 closed defect (fixed)

bbp_set_current_user_default_role() doesn't seem to be adding default roles to non WP roles added by other plugins

Reported by: nerrad Owned by:
Milestone: 2.2.1 Priority: high
Severity: normal Version: 2.2
Component: API - Roles/Capabilities Keywords: has-patch
Cc: stephen@…

Description

This is the behaviour observed for s2member.

See related discussion here -> http://bbpress.org/forums/topic/fix-for-users-of-s2member-and-bbpress-2-2/

I'm "assuming" that this is happening for other membership plugins other than s2member but that's an assumption based on observed behaviour with s2member.

Before making suggestions here, I'll do some more testing to see why the s2member added roles aren't being picked up.

Attachments (1)

2042.001.patch (572 bytes) - added by nerrad 7 years ago.
make sure any custom roles added by a plugin are given default bbp role

Download all attachments as: .zip

Change History (14)

#1 @nerrad
7 years ago

okay the current s2member role IS retrieved via $bbp->current_user->roles but there is nothing being done to handle that role if it doesn't match anything in the default bbp_get_user_role_map(). the loop there just checks for roles that match something in the default map.

The question is then, how do we handle this? I suggest that we have any other roles detected given the default bbp role. Something like what I'll post in a patch after this comment.

#2 @netweb
7 years ago

  • Cc stephen@… added
  • Component changed from Users to Roles/Capabilities

@nerrad
7 years ago

make sure any custom roles added by a plugin are given default bbp role

#3 @nerrad
7 years ago

  • Keywords has-patch added; needs-patch removed

#4 @nerrad
7 years ago

I don't like the duplication of code in the patch, but at least it points to what needs to be changed/modified.

#5 @johnjamesjacoby
7 years ago

  • Milestone changed from Awaiting Review to 2.2.1

#6 @johnjamesjacoby
7 years ago

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

(In [4447]) Roles:

  • Remove unused Visitor role.
  • Map non-WordPress roles to default role.
  • Hat-tip nerrad for confirmation/testing.
  • Fixes #2042 (trunk)

#7 @johnjamesjacoby
7 years ago

(In [4448]) Roles:

  • Remove unused Visitor role.
  • Map non-WordPress roles to default role.
  • Hat-tip nerrad for confirmation/testing.
  • Fixes #2042 (2.2 branch)

#8 @nerrad
7 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

awesome... like the fix too.

#9 @nerrad
7 years ago

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

#10 @johnjamesjacoby
7 years ago

(In [4449]) Roles:

  • get_editable_roles() is an admin function, so copy over functionality into bbp_get_user_blog_role().
  • See #2042 (2.2 branch)

#11 @johnjamesjacoby
7 years ago

(In [4450]) Roles:

  • get_editable_roles() is an admin function, so copy over functionality into bbp_get_user_blog_role().
  • See #2042 (trunk)

#12 @johnjamesjacoby
7 years ago

(In [4451]) Tools/Roles:

  • In user-map repair tool, use default role if role-map entry does not exist.
  • See #2042 (trunk)

#13 @johnjamesjacoby
7 years ago

(In [4452]) Tools/Roles:

  • In user-map repair tool, use default role if role-map entry does not exist.
  • See #2042 (2.2 branch)
Note: See TracTickets for help on using tickets.