Custom User Role

Okay, so I have done it.

Reading about roles and capabilities: http://codex.wordpress.org/Roles_and_Capabilities

A default set of capabilities is pre-assigned to each role, but other capabilites can be assigned or removed using the add_cap() and remove_cap() functions. New roles can be introduced or removed using the add_role() and remove_role() functions.

Add a capability: http://codex.wordpress.org/Function_Reference/add_cap

If you want to add a new role with capabilities, just add them when you add the role using add_role();.

Reading about adding a menu: http://codex.wordpress.org/Function_Reference/add_menu_page

$capability (string) (required) The capability required for this menu
to be displayed to the user.

Step 1: Register an activation hook to create a new user role

register_activation_hook( __FILE__, 'plugin_newuserrole' );

function plugin_newuserrole() { 
global $wp_roles;

$result = add_role(
    'user_dj',
    __( 'DJ' ),
    array(
        'read'         => true,  // true allows this capability

    )
);
/* if ( null !== $result ) {
    echo 'Yay! New role created!';
}
else {
    echo 'Oh... the user_dj role already exists.';
} */
}

Step 2: Add a capability to the role

function plugin_caps() {
// gets the new role made earlier
$role = get_role( 'user_dj' );

// This only works, because it accesses the class instance.
// would allow the author to edit others' posts for current theme only
$role->add_cap( 'dj_hk_user' ); 
}
add_action( 'admin_init', 'plugin_caps');

Step 3: Change capability options in menu and submenu

function add_your_menu() {
add_menu_page( 'Title', 'Menu Label', 'dj_hk_user', 'plugin-slug.php', '', 'dashicons-microphone');
add_submenu_page( 'plugin-slug.php', 'Overview', 'Overview', 'dj_hk_user', 'plugin-slug.php', 'function_of_overview' );
add_submenu_page( 'plugin-slug.php', 'Sample Edit Title', 'Sample Edit Label', 'dj_hk_user', 'sample_slug', 'function_of_page1' );    
}
add_action('admin_menu', 'add_your_menu');

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