Jak skrýt vybrané stránky či příspěvky v administraci uživatelům

/—code php
function jp_exclude_pages_from_admin($query) {

if ( ! is_admin() )
return $query;

global $pagenow, $post_type;

if ( !current_user_can( ‚administrator‘ ) && is_admin() && $pagenow == ‚edit.php‘ && $post_type == ‚page‘ ) {
$query->query_vars[‚post__not_in‘] = array( ’10‘, ‚167‘, ‚205‘ ); // ID stránek, které se mají skrýt „neadminům“
}
}

add_filter( ‚parse_query‘, ‚jp_exclude_pages_from_admin‘ );
\—

„Zdroj »“:http://www.johnparris.com/how-to-hide-pages-in-the-wordpress-admin/

Nastavení úrovně přístupu v pluginech

Almost every plugin needs to have at least one page in the admin area to let users customize how the plugin is used. In order to do this, you need to add your own administration menu items. There are a bunch of WordPress functions which let you do this:

/—code php
// add top level menu
add_menu_page(page_title, menu_title, capability, handle, [function], [icon_url]);

// add sub-menu pages
add_submenu_page(parent, page_title, menu_title, capability, file/handle, [function]);

// add Options sub-menu
add_options_page(page_title, menu_title, capability, handle, [function]);

// add Management sub-menu
add_management_page(page_title, menu_title, capability, handle, [function]);

// add Pages sub-menu
add_pages_page( page_title, menu_title, capability, handle, [function]);

// add Posts sub-menu
add_posts_page( page_title, menu_title, capability, handle, [function]);

// add Appearances sub-menu
add_theme_page( page_title, menu_title, capability, handle, [function]);
\—

**Více informací viz**
„Ultimate Guide to Roles and Capabilities“:http://www.garyc40.com/2010/04/ultimate-guide-to-roles-and-capabilities/

Zobrazení obsahu pouze přihlášeným uživatelům

Do souboru **functions.php** (Vzhled > Upravit soubory) stačí přidat následující:

/—code php
add_shortcode( ‚member‘, ‚member_check_shortcode‘ );

function member_check_shortcode( $atts, $content = null ) {
if ( is_user_logged_in() && !is_null( $content ) && !is_feed() )
return $content;
return “;
}
\—

Pak už stačí kdekoli v příspěvku „obalit“ text určený pouze registrovaným uživatelům tagem [member]:

/—code php
[member]
Toto se zobrazí pouze přihlášeným uživatelům
[/member]
\—

Je-li potřeba to nastavit už v šabloně vzhledu, je třeba použít

/—code php

\—

„Více příkladů »“:http://justintadlock.com/archives/2009/05/09/using-shortcodes-to-show-members-only-content

Rozšířené nastavení uživatelských práv

**Capability Manager**
„http://wordpress.org/extend/plugins/capsman/“:http://wordpress.org/extend/plugins/capsman/
„http://alkivia.org/wordpress/capsman/“:http://alkivia.org/wordpress/capsman/

The Capability Manager plugin provides a simple way to manage role capabilities. Using it, you will be able to change the capabilities of any role, add new roles, copy existing roles into new ones, and add new capabilities to existing roles. You can also delegate capabilities management to other users. In this case, some restrictions apply to this users, as them can only set/unset the capabilities they have. With the Backup/Restore tool, you can save your Roles and Capabilities before making changes and revert them if something goes wrong.

Použito na soutěžním webu Fujitsu.

**User Role Editor**
„http://wordpress.org/extend/plugins/user-role-editor/“:http://wordpress.org/extend/plugins/user-role-editor/

With User Role Editor WordPress plugin you can change user role (except Administrator) capabilities easy, with a few clicks. Just turn on check boxes of capabilities you wish to add to the selected role and click „Update“ button to save your changes. That’s done. Add new roles and customize its capabilities according to your needs, from scratch of as a copy of other existing role.

**Adminimize**
„http://wordpress.org/extend/plugins/adminimize/“:http://wordpress.org/extend/plugins/adminimize/

Adminimize is a powerful free plugin that lets you control who has power over every aspect of your website. You can deactivate every possible option you can think of and control what admin, editors, authors, contributors and subscribers can do. The plugin automatically recognises any new user groups you have created too. In short, it gives you complete control over what every user on your site can and cannot do. It works well with a number of other popular plugins too and is updated fairly regularly.
Lets you hide ‚unnecessary‘ items from the WordPress backend.