How to Customize Your WordPress Admin Dashboard | WordPress User Dashboard Plugin

customize the WordPress Dashboard for Clients | WP Plugins




Continuing the article colleague Diogo spine on Customizing WordPress Administration Panel for its clients, in this second part we will show how you can remove unnecessary menus in WordPress administration. Sometimes we do not want our customers to have access to all the parts that create the features of the website in WordPress, such as uninstall plugins, change the subject or modify settings of the Global options. At first, when I started creating websites in WordPress I gave freedom to my clients that they can change whatever they wanted, giving access to the admin panel with administrator privileges. However, in some cases, my clients were more “curious” that “connoisseurs” of the tool and this allowed the mangling of some sites.

At this point, continuing to provide access as an administrator, I take some panels I think unnecessary for the normal functioning of the site, such as the theme of change section. The customer does not need to find out what a theme and that can change if what he wants is a site with your own layout. The customer does not need to learn that there are plugins, or at least should not have access to uninstall plugins critical to the proper functioning of your site. These are small changes that I make today.
CHANGING THE MENUS WORDPRESS
To simplify the process of creating content for the customer, make WordPress a more appealing environment is essential ! For those who do not need features such as links , blogs and comments features , it becomes simpler if you remove it from the customer’s view .

Other ways to customize the WordPress Dashboard for Clients

Fortunately , there is a hook action that can help us in this matter : add_action ( ‘ admin_menu ‘); We will create a specific plugin to handle this :
< ? Php
/ *
Plugin Name : Simplifying Panel
Author: WordPress School
Description: Removes some menus that are not needed at some sites .
Version : 1.0
* /
add_action ( ‘ admin_menu ‘ ‘ custom_remove_menus ‘);
custom_remove_menus function () {
    // Removing the page of categories
    remove_submenu_page ( ‘ edit.php ‘, ‘ edit- tags.php taxonomy category = ? ‘);
    // Removing editing posts – blog feature
    remove_menu_page ( ‘ edit.php ‘);
    // Removing the menu access to comments
    remove_menu_page ( ‘ edit- comments.php ‘);
    // Removing the Tools menu
    remove_menu_page ( ‘ tools.php ‘);
    // Removing Links Manager
    remove_menu_page ( ‘ link – manager.php ‘);
    // Removing the Theme Manager
    remove_menu_page ( ‘ themes.php ‘);
    // Removing the Plugin Manager
    // Remove_menu_page ( ‘ plugins.php ‘);
}
The action hook processes the function that will handle call successive times remove_menu_page and remove_submenu_page functions. This way you can remove whatever you want or not. Simply comment (// insert before the code) to leave this functionality intact or uncomment to remove the desired feature menu.
MANAGE WEBSITES SIMPLE WITH WORDPRESS
We already know that WordPress is very powerful both when acting as a simple blogs manager as when acting as a true CMS. You will be able to take advantage of the WordPress maximum of any of the ways. It turns out that in some cases, WordPress offers too much functionality to the website that we are implementing. Websites that require only 4 or 5 pages of content, can be as a “punishment” for those who will manage this content. The solution is to remove functionality, either as described above or via a plug.
Fortunately colleagues PixoPoint contributed to the community through a plugin solution that turns WordPress into a basic CMS for simple static websites management. This plugin removes all kinds of complicated features that comes by default with WordPress that are not necessary for this type of sites.
DOWNLOAD and INSTALLATION
You can download the free plugin by clicking here.
After you in possession of the ZIP file can log into the administration and upload the plugin through the Plugins page by clicking add new plugin.
If for some reason does not work, you can just upload the files in the ZIP content to wp-content / plugins directory / of your WordPress.
Note: this plugin only simplifies the WordPress administration area for accounts below administrator. Thus, if you are logged in as amdinistrador you will not see any difference. You’ll have to create a publisher account. We will see below how to change this behavior.
TEMA SIMPLE STATIC WEBSITES
In addition to the plugin, the PixoPoint launched a simple theme so you can start programming your new simple website from it.
UNDERSTANDING THE CODE PLUGIN
If you open the ryans-simple-cms.zip ZIP file downloaded earlier, you will see 3 files, and one is the plugin itself, it is the only PHP file. Open it in a simple file editor. If you have Windows environment recommend using Notepad ++.
For the functionality it carries is very little, do not you think? The explanation for this is that this plugin uses the same concept of hooks we saw above. Passing all informative part and comments plugin, we will take a look at __construct () method of the plugin:
public function __construct() {
    // Add action hooks
    add_action( ‘admin_menu’,                 array( $this, ‘remove_menus’ ) );
    add_action( ‘wp_before_admin_bar_render’, array( $this, ‘remove_admin_bar_links’ ) );
    add_action( ‘admin_menu’,                 array( $this, ‘remove_meta_boxes’ ) );
    add_action( ‘wp_head’,                    array( $this, ‘simplecms_comments’ ) );
}




This method adds the necessary actions to trigger the functions that will simplify the administration panel . The admin_menu hook is used to remove menus and also the boxes goal of the WordPress admin panel , just as we have done in the previous article . The hook wp_before_admin_bar_render serves to remove or add links in the administration bar. In this case we will take several links that do not want to be present .
function remove_admin_bar_links() {
    // Bail out now if not in admin or user can’t activate plugins
    if ( current_user_can( ‘manage_options’ ) || ! is_admin() )
        return;
    global $wp_admin_bar;
    $wp_admin_bar->remove_menu( ‘comments’ );
    $wp_admin_bar->remove_menu( ‘new-content’ );
    $wp_admin_bar->remove_menu( ‘blog-6-n’ );
    $wp_admin_bar->remove_menu( ‘blog-6-c’ );
}
This function removes each item we do not want to be present in adminsitração bar. In this case , remove the links to new content and comments using the remove_menu method that accepts a string as a parameter. This string is the rendered ID of the object you want to remove.
function remove_menus () {
    // Bail out now if not in admin or user can’t activate plugins
    if ( current_user_can( ‘manage_options’ ) || ! is_admin() )
        return;
    // List of items to remove
    $restricted_sub_level = array(
        ‘edit-tags.php?taxonomy=category’ =>’edit.php’, // This doesn’t actually do anything since posts aren’t present, but left here so that you can see how to remove sub menus if needed in your own projects
        ‘edit.php’                        => ‘TOP’,
        ‘edit-comments.php’               => ‘TOP’,
        ‘tools.php’                       => ‘TOP’,
        ‘link-manager.php’                => ‘TOP’,
    );
    foreach( $restricted_sub_level as $page => $top ) {
        // If a top leve page, then remove whole block
        if ( ‘TOP’ == $top )
            remove_menu_page( $page );
        else
            remove_submenu_page( $top, $page );
    }
    // Redirect from dashboard to edit pages – Thanks to WP Engineer for this code snippet … http://wpengineer.com/redirects-to-another-page-in-wordpress-backend/
    if ( preg_match( ‘#wp-admin/?(index.php)?$#’, esc_url( $_SERVER[‘REQUEST_URI’] ) ) )
        wp_redirect( admin_url( ‘edit.php?post_type=page’ ) );
}
This class method removes the menus in the same way that we removed upon passing the dashboard page slug we want to remove the remove_menu_page and remove_submenu_page functions. This technique used here is quite intuitive. You create an array with all the slugs of the pages you want to remove the panel, and then applies a foreach loop that goes through each of the array elements one by one and removing it via the function.
It is in this function that you can take the administrator’s condition could not see the simplifications. Remove only the following code:
// Bail out now if not in admin or user can not activate plugins
if (current_user_can ( ‘manage_options’) ||! is_admin ())
    return;
Analyzing the end of the method, we see that there is a hack to link the administration. Basically what it does is, if there is a call to the administration of WordPress, it redirects the dashboard for pages listing. In this way makes the process of creating more intuitive pages.




LEAVE A REPLY

Please enter your comment!
Please enter your name here