members icon indicating copy to clipboard operation
members copied to clipboard

Role meta

Open justintadlock opened this issue 8 years ago • 1 comments

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.

justintadlock avatar Aug 29 '16 13:08 justintadlock

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

renatonascalves avatar Jul 05 '17 17:07 renatonascalves