Пример #1
0
function hocwp_is_subscriber($user = null)
{
    $user = hocwp_return_user($user);
    if (!is_wp_error($user)) {
        $role = hocwp_get_user_role($user);
        if ('subscriber' == $role) {
            return true;
        }
    }
    return false;
}
Пример #2
0
function hocwp_setup_body_class($classes)
{
    $classes[] = 'hocwp';
    if (is_multi_author()) {
        $classes[] = 'group-blog';
    }
    if (is_user_logged_in()) {
        $role = hocwp_get_user_role();
        $role = hocwp_sanitize($role, 'html_class');
        $classes[] = 'role-' . $role;
    }
    return $classes;
}
Пример #3
0
function hocwp_classifieds_admin_menu()
{
    $role = hocwp_get_user_role(wp_get_current_user());
    if ('subscriber' == $role) {
        $post_types = get_post_types();
        unset($post_types['post']);
        foreach ($post_types as $post_type) {
            remove_menu_page('edit.php?post_type=' . $post_type);
        }
        remove_menu_page('edit-comments.php');
        remove_menu_page('tools.php');
    }
}