espressoguy
Member
Posted 3 years ago #
After Installing WordPress I notice that there doesn't seem to be a wordpress table in the Database mapping users to "roles".
I'd like to adapt a role-based open source calendar software package to WordPress ...so the calendar would have to get usernames and roles from WordPress ...but I don't see how WordPress is mapping users to roles.
Could someone familiar with this explain it to me? Thanks in advance.
Assuming your $table_prefix in wp-config.php is 'wp_'
That mapping of role to user is handled via a row in wp_usermeta with each user_id and the meta_key wp_capabilities
Also see Roles and Capabilites and check the Resources section of that article for plugins that deal with the topic.
espressoguy
Member
Posted 3 years ago #
Thanks so much MichaelH ...that was very helpful.
One thing I still don't understand however is how to interpret the wp_capabilities string. For example, this:
a:1:{s:10:"subscriber";b:1;}
...looks like seven or eight colon-delimited fields describing capabilities somehow but I don't see the documentation of it anywhere on the "Roles and Capabilities" page.
Or perhaps I should work instead with a function that simply gets the capabilities from the database and returns them to me so that my code can say "Oh now I see what this user can and can't do". Either way is fine by me.