justintadlock / members

Members WordPress plugin.
GNU General Public License v2.0
404 stars 97 forks source link

Enhancement - import/export roles #36

Open danbalbo opened 9 years ago

danbalbo commented 9 years ago

Hi Justin,

Question / Enhancement - Is it possible to add a functionality to export/import roles?

justintadlock commented 9 years ago

I've never really looked into it. I think it'd be a cool idea. Patches are welcome!

korobochkin commented 9 years ago

And sync roles between sites in Multisite install :+1:

AaronHolbrook commented 7 years ago

Would love to see a way to export the code required for adding to the codebase, i.e. Advanced Custom Fields Pro or WP Forms.

justintadlock commented 7 years ago

Just thinking this through a bit in my head. One question that popped up was with what to do with duplicates.

For example, let's say you already have an administrator role on the site. Then, you import a set of roles that also has the administrator role. How is this scenario best handled?

Any other ideas?

AaronHolbrook commented 7 years ago

I would rather see the hardcoded / code based code would take higher precedence.

That's the way ACF handles it, and then if the hardcoded role disappears the DB based one takes over.

justintadlock commented 7 years ago

There wouldn't be anything hardcoded. We're talking about importing roles into the DB.

warudin commented 6 years ago

Just a question: is the configuration for roles currently not saved in the database? If no, where is it being saved?

theo-ct commented 5 years ago

Will have a think. Am wondering if would be best to potentially give a warning though - so any differences asking the user if they want to overwrite?

justintadlock commented 5 years ago

A warning is definitely in order regardless of how it's handled.

I've taken a small look at some of the under-the-hood code for this. A complete overwrite is easiest from a code perspective (delete all existing roles and replace with imported roles).

I'd probably lean toward something like the following as a set of rules:

How realistic that is will likely take diving into the code.