Role based permission edit for plugins

I think the plugin include the possibility with one check for rights, for a capability. You see in the source of the plugin, that he include the menu items, if the user have the capability edit_theme_options. That makes not so easy for you to change this in different roles. You can create custom roles, like … Read more

Creating a folder structure

I don’t think what you want is URL rewriting. If I understand correctly, what you want is to restrict access to certain pages, posts, categories, etc., based on the current user’s role or capabilities: “If logged in, do something. If not, do something else (like prompt to login or register).” Modifying the output/behavior of a … Read more

Conditional Tag for Wishlist membership. If the user is added to two levels show particular content

If you’re running the latest version of WishList Member, it now has built-in API functions for stuff like this. Using those, you’d do this: wp_get_current_user(); $gold_sku = 123456789; $silver_sku = 987654321; $user_id = $user->ID; if ( wlmapi_is_user_a_member($gold_sku, $user_id) ) { //Do gold stuff here } elseif ( wlmapi_is_user_a_member($silver_sku, $user_id) ) { //Do silver stuff here … Read more

How can I call a specific file (via php) by referencing the logged-in username?

Try to do this: <?php global $current_user;?> <?php if(is_user_logged_in()) :?> <?php get_currentuserinfo();?> <?php if(is_array( $current_user->roles ) && in_array( ‘map_user’, $current_user->roles ) ) : ?> <div id=”mapContent”> <?php require(“/mapping/”.$current_user->user_login.”.html/”); ?> </div> <?php endif; ?> <?php endif; ?> Source codex.wordpress.org

display specific sidebar for each role

You could either read the role of the current user, then show the desired sidebar elements, or (what I’d prefer) check for certain capabilities. User Role global $current_user; $roles = $current_user->roles; $role = array_shift( $roles ); switch ( $role ) { case … } Capabilities if ( current_user_can( SOME_CAP ) ) { } elseif ( … Read more

Get Authors Role

As an alternative to “current_user_can” WordPress provides “user_can” which will take a User object or ID as a parameter. Combining your top code and the bottom code with the new function it would look like this: $author_user = $wp_query->get_queried_object(); // the queried object in ‘author.php’ should be an author user if (user_can($author_user, ‘buyer’)) { get_template_part( … Read more

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