User role : Ver.1.4.1

  • In Progress
    Posted in: BlackFyre  
  • Member
    acr0mania
    August 21, 2015 at 8:14 pm #65891

    A new registrant is best “gamer” role!But “contributor” and “editor” role should be allowed to log in to the dashboard.

    If there is more than one contributor,Do I have to change everyone to “administrator” role?

    #functions.php

    /*hide admin bar for all users except admin*/
    function skywarrior_admin_bar(){

    if (!current_user_can(‘administrator‘) && !is_admin()) {
    show_admin_bar(false);
    }
    }
    add_action( ‘after_setup_theme’ , ‘skywarrior_admin_bar’);

    /*restrict admi naccess for non admins*/
    function skywarrior_restrict_admin() {
    $user = new WP_User( get_current_user_id() );
    if ( !current_user_can( ‘manage_options’ ) ) {
    if($user->roles[0] !=’gamer‘){
    wp_die( __(‘You are not allowed to access this part of the site’, ‘blackfyre’));
    }elseif((strpos($_SERVER[‘REQUEST_URI’], “post_type=clan”) != true) && (strpos($_SERVER[‘REQUEST_URI’], “admin-ajax.php”) != true) && (strpos($_SERVER[‘REQUEST_URI’], “post.php”) == true && strpos($_SERVER[‘REQUEST_URI’], “image-editor”) == true) ) {
    wp_die( __(‘You are not allowed to access this part of the site’, ‘blackfyre’));
    }
    }
    }

    Is there a way to add other roles?

    Sorry, this forum is for verified users only. Please Login or Register to continue

Comments are closed.