superdude
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Accessing a custom capabilityi 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! 🙂
Forum: Fixing WordPress
In reply to: Accessing a custom capabilityAFter 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.
Forum: Plugins
In reply to: creating custom capability with role manager failsHello, i can create a custom capability, and assign it to a role no problem. Now i am trying to do the following And it doesnt work, can anyone help, how do i access this custom capability. Basically what i want to do is check if a user has that capability assigned to him or not, and then i am going to use if else statements like below to set a value depending on whether he have access or not and return that value somewhere else and do whatever i like with it, has anyone done this? I have search far and wide, no luck :(.
if ( current_user_can(‘Hbpediapublisher’) )
{
$myHbPediaLevel = “12”;
}
elseif( current_user_can(‘Hbpediaeditor’) )
{
$myHbPediaLevel = “11”;
}
?>
</p>
</form>