Simple Membership Plugin › Forums › Simple Membership Plugin › Roles Lost By Editing Profile
- This topic has 11 replies, 3 voices, and was last updated 1 month, 1 week ago by
bobgarrett.
-
AuthorPosts
-
February 1, 2026 at 9:47 am #31861
bobgarrett
ParticipantWe have found that using [swpm_profile_form] to allow a member to edit their profile e.g. name or other custom fields they then lose their WordPress roles. For example someone who was “Author” becomes “Subscriber” and their “participant” access rights to BBPress gets removed.
It seems the code is not noting the existing rights when updating the user records.February 2, 2026 at 1:48 am #31872The Assurer
ModeratorThis is a known gotcha with Simple WP Membership (SWPM). You’re not imagining it. 👍
What’s happening is exactly what you described: SWPM overwrites the WordPress role when the profile is saved, instead of preserving the existing one.When a user submits the [swpm_profile_form], SWPM:
1. Updates the WordPress user record
2. Reassigns the WP role based on the SWPM membership level
3. Defaults to subscriber if the membership level doesn’t explicitly define a roleThis is by design in SWPM, but it’s pretty destructive if you’re mixing SWPM with WordPress-native roles or bbPress permissions.
Why bbPress access disappears
bbPress uses WordPress roles, not SWPM access levels.
Once the role is reset to subscriber, the user loses:
* bbp_participant
* author
* any custom capability-based accessThe cleanest fix: preserve the existing role
You can intercept the profile update and restore the original role after SWPM finishes saving.
Add this to your theme’s functions.php or a small custom plugin:add_action('swpm_profile_update', function($member_id, $wp_user_id) { if (empty($wp_user_id)) { return; } $user = get_userdata($wp_user_id); if (!$user) { return; } // Store roles before SWPM changes them static $original_roles = []; if (!isset($original_roles[$wp_user_id])) { $original_roles[$wp_user_id] = $user->roles; } // Restore roles $user->set_role(''); // remove all roles first foreach ($original_roles[$wp_user_id] as $role) { $user->add_role($role); } }, 20, 2);Why this works
* SWPM runs earlier and sets subscriber
* This runs after (priority 20)
* Original roles are restored intactFebruary 2, 2026 at 9:13 am #31873bobgarrett
ParticipantThank you for the explanation but surely the plugin should do this itself?
Also, what if the user was an Admin, would they lose their rights and thus be unable to manage the site at all.February 3, 2026 at 3:20 am #31875The Assurer
ModeratorYou’re right on both counts:
✅ Yes, the plugin should preserve roles
⚠️ Yes, admins can lock themselves out❌ SWPM assumes ownership of WP roles, which is unsafe in mixed setups
Since SWPM is open source code you are welcome to make your own changes; or to properly address this, you should consider using our paid support service:
https://simple-membership-plugin.com/paid-support-simple-membership-plugin/February 4, 2026 at 12:32 am #31876admin
KeymasterThe WordPress role that SWPM assigns is configured at the membership level. You can edit the relevant membership level and check the “Default WordPress Role” field to see which role is set for that level. When a member belongs to that membership level and their profile is saved, the specified role is applied to that member.
To clarify, are you saying that you’ve set a WordPress role in the membership level configuration, but it is not being applied when the member’s profile is saved?
I just want to understand whether the plugin isn’t behaving as expected, or if something else might be interfering with the process.
February 4, 2026 at 9:18 am #31900bobgarrett
ParticipantIt seems we had overlooked setting “Author” as being the default for one membership type so have now done that which will hopefully fix one issue.
Thank you. Though that does mean we cannot have different types of WP role within a single member category.
However, I assume this will not fix the other one which is that the role for BBPress of “Participant” will not be preserved if a member edits their custom fields despite us ticking BBPress Integration in SWPM Settings?February 5, 2026 at 6:05 am #31901admin
Keymasterokay so the WordPress user role is working as intended. The issue is that the user’s “Forum Role” (for bbPress) gets updated/changed which causes the issue right?
February 5, 2026 at 6:09 am #31902admin
KeymasterOne more question, are you using any other addon besides the bbPress Integration addon on this site?
February 5, 2026 at 2:01 pm #31903bobgarrett
ParticipantHaving corrected the setup for WP roles and tested it then if a user changes their custom fields etc. then the WP role defaults correctly. However, the BBPress role is still lost.
And yes, we have a lot of other plugins!
February 5, 2026 at 11:51 pm #31904admin
KeymasterThank you. Looks like you are using the Form Builder addon with bbPress. I think the Form Builder needs a small update for this. I will investigate this more and get back to you with an update.
March 4, 2026 at 1:31 am #31945admin
KeymasterWe have released an update that should solve this.
March 8, 2026 at 9:28 am #31960bobgarrett
ParticipantThank you. Now installed.
-
AuthorPosts
- You must be logged in to reply to this topic.