Add Capability of Custom Plugin to a Role

To add new Capability of a custom made plugin in WordPress to a specific Role.

function add_theme_caps() {
    // gets the author role
    $role = get_role('editor');

    // This only works, because it accesses the class instance.
    // would allow the author to edit others' posts for current theme only
    // just mention your plugin filename like I have edit_events.php as my plugin
    $role->add_cap('edit_events'); 
}
add_action( 'admin_init', 'add_theme_caps');

To add new Capability of a custom made plugin in WordPress to a specific user.

function add_theme_caps() {
    // get the user
    $user = new WP_User( $user_id );

    // This only works, because it accesses the class instance.
    // would allow the author to edit others' posts for current theme only
    // just mention your plugin filename like I have edit_events.php as my plugin
    $user->add_cap('edit_events'); 
}
add_action( 'admin_init', 'add_theme_caps');

Give Editor Access To WordPress Sidebar

If you want to give the Editor Role access to editing the sidebar and it’s contents.

The edit_theme_options capability should allow the user to edit the sidebar as described on this page : http://codex.wordpress.org/Appearance_Widgets_SubPanel

Code to add to functions.php

$role = get_role('editor'); 
$role->add_cap('edit_theme_options');

or, you can use Members plugin to create/manage other roles and modify the capabilities.

http://wordpress.org/plugins/members/

This should work to prevent editor accessing themes or menus

function custom_admin_menu(){

    $user =new WP_User(get_current_user_id());if(!empty( $user->roles)&& is_array($user->roles)){foreach($user->roles as $role)
            $role = $role;}if($role =="editor"){ 
       remove_submenu_page('themes.php','themes.php');
       remove_submenu_page('themes.php','nav-menus.php');}}

add_action('admin_menu','custom_admin_menu');

How to add excerpt on a Page in WordPress without plugin

To add an excerpt field in WordPress Pages like we have in Posts, just paste the following code to your functions.php and have fun !!

add_post_type_support( 'page', 'excerpt' );

List of WordPress Multisites (MU) Blogs

<?php
// Query for getting blogs
$blogs = $wpdb->get_results( $wpdb->prepare("SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' ORDER BY registered DESC", $wpdb->siteid), ARRAY_A );

// put it in array
foreach ( (array) $blogs as $details )
{
$blog_list[ $details['blog_id'] ] = $details;
}
unset( $blogs );
$blogs = $blog_list;

// if is valid array
if (is_array( $blogs ) )
{
echo '<ul>';
$array= array();
// reorder
$array= array_slice( $blogs, 0, count( $blogs ) );
for($i=0;$i<count($array);$i++)
{
// get data for each id
$blog = get_blog_details( $array[$i]['blog_id'] );
// print it
echo '<li><a href="'.$blog->siteurl.'">'.$blog->blogname.'</a></li>';
}
echo '</ul>';
}
?>