Custom Capabilities for CPT and Problem with current_user_can()

Solved! Meta Capabilities edit_product, delete_product, ‘read_product` etc should be handled separately. Below code is from Justin Tadlocks Site add_filter( ‘map_meta_cap’, ‘fac_map_meta_cap’, 10, 4 ); function fac_map_meta_cap( $caps, $cap, $user_id, $args ) { /* If editing, deleting, or reading a product, get the post and post type object. */ if ( ‘edit_product’ == $cap || ‘delete_product’ … Read more

Give Editor Access to Custom Theme Options

The problem is that the default Editor role does not have enough capabilities to change theme options. You are allowing users with ‘moderate_comments’ capabilities to view the page. That in itself is not enough. When the user attempts to update, it fails because the user does not have the proper capabilities, hence the ‘Cheatin’ uh?’ … Read more

How to hide a HTML element based on user role

You could use something like this if you have jquery included in your page: <?php if ( is_super_admin() ) { ?> <script type=”text/javascript”> $( document ).ready(function() { $(“#IDofDivHoldingUserTopBar”).css(“display”, “none”); // ID of user top bar // ……………………….. OR $(“.ClassofDivHoldingUserTopBar”).css(“display”, “none”); // class of user top bar }); </script> <?php } ?>

User restricted only show posts assigned to current user

You search certainly something like Members plugin. It allow you create a custom Role and You can make your site and its feed completely private if you want or just one or 2 posts. Its like you want. Or Manually, you can add new roles: function add_role() { add_role( ‘private_user’, “private user”,array( ‘is_able_to_read_private_page’=> true, ‘read’=> … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)