justintadlock / members

Members WordPress plugin.
GNU General Public License v2.0
407 stars 101 forks source link

Role meta #110

Open justintadlock opened 7 years ago

justintadlock commented 7 years ago

We need a way to store role meta so that add-ons can easily have a way to store additional data for a role.

I don't really like the idea of creating an entire wp_rolemeta table even though it'd make it really easy to extend with *_meta() functions. It seems like that'd be overkill. Plus, roles don't have a table of their own nor associated IDs. So, that idea is probably off the table anyway.

A simple option under wp_options would probably suffice. I'm thinking storing a set of metadata for each role as a single option would work like so:

members_role_meta_{$role_slug} = array(
    key => value,
    key => value
);

The other option would be a single DB option like so:

members_role_meta = array(

    $role_slug = array(
        key => value,
        key => value
    ),
    $role_slug2 = array(
        key => value,
        key => value
    )
);

I lean toward the former in the off-chance that someone has a lot of role meta that they want to store. Just seems like it'd scale a lot more nicely.

renatonascalves commented 7 years ago

Second option seems better to me. I also agree with you a custom table might be too much.