AFter some many hours of frustrating investigating, i found my answer. There is a table called “wp_usermeta”, in there find the id of the person you are interested in. now if you have given them permissions to the custom capability you created, it will reflect here. this is where you will find it.
1. Use sqlyog or whatever and run “select * from wp_usermeta” on the db
2. Then locate the user_id
3. look at the column named “meta_key” and look for “wp_capabilities”.
4. Now next to it the is a column named “meta_value”.
5. In my example above, my custom capability is “Hbpediapublisher” and “Hbpediaeditor”, and since i have allowed this user that capabilities, you will see “a:3:{s:13:”hbpediaeditor”;b:1;s:16:”hbpediapublisher”;b:1;s:13:”administrator”;b:1;}”
If they where not given those capabilities, you will see something like
“a:1:{s:13:”administrator”;b:1;}”.
Hope this helps someone who was as lost as i.
you’re not pulling this straight from the DB are you? – that’s completely unnecessary.
you don’t “check it against” anything… the current_user_can function does the checking for you.
so, once you’ve created the capability, you assign that capability to a user, and current_user_can checks whether this user has that capability.
that’s all… no custom queries into the database, no nothing.
i am actually, then i run a query in my custom php page to see if a user has that capability in it, and if there is, i set my new php page to provide the functionality based on that only. My whole plan is to create a new page, which is a link from my plugin on the main page, i pass the users variables to my new page, and then use the id to check in the db in that wp_usermeta table if they have the capability by checking for those values. I dont understand or am still getting to grips with how wordpress works, let alone php. I am 3 weeks into it from no experience. I am going to look over what you have said about he current user function and try to understand it like you guys do and get it done that way.
thanks a mil for your help man! 🙂
lets try to iron this out for you…
what do you think the “current_user_can” function does? It’s gotta do something right? otherwise it wouldn’t exist.
If you can cover that for me, that’ll be a great starting point from which to explain the process. I’m sure I’m going to be covering stuff you already know, but we need to start somewhere.