If I’m looking at the forum plugin correctly, it appears to be using capability names like SPF Manage Users
. Ideally, such a capability would be named spf_manage_users
.
While it is technically possible to name a capability anything, the standard has been well established since WordPress version 2.1 (when roles and caps were introduced) — caps should be all lowercase with underscores to separate words (snake case). Having a standard gives us a consistent and reliable way to sanitize or validate that something is in fact a capability.
Members will sanitize capabilities on its edit role screen (for security purposes mainly). Most role/cap plugins are going to do something similar. This is going to remove the spaces and is likely the issue you’re experiencing. I saw that you had issues with User Role Editor too. I imagine it’s going to be the same issue.
Members does have a filter hook to change this behavior with a few lines of code, but I just realized it doesn’t pass in the original, unsanitized cap, which sort of makes the hook useless (hey, we found a bug!). I could put that on the agenda for the next version. I don’t mind doing that.
If you absolutely need this before the next version, you can open up members/inc/functions-capabilities.php
and change this code on line 245:
return apply_filters( 'members_sanitize_cap', sanitize_key( $cap ) );
To this:
return apply_filters( 'members_sanitize_cap', sanitize_text_field( $cap ) );
That should fix it assuming that’s where the issue lies. This is just an educated guess on my part.
For the long term, I’d recommend the forum plugin building in an upgrade routine to convert to the cap-naming scheme that core WordPress uses.