WordPress.org

Ready to get started?Download WordPress

Forums

Redirect Users Based on Role (2 posts)

  1. acmc42
    Member
    Posted 3 years ago #

    I have multisite set up with subdirectories. I have set up three custom roles. Members are users of specific sites. Each role is redirected to a specific admin page based on their custom role. The problem is all users log in on the Main site. Members have no role in the main site. Therefore my redirect rule is ignored.

    Here is the redirect:

    function fb_redirect_2(){
        get_currentuserinfo();
    	//in here put if user is member of this blog do this else find the blog they are a user of and then do the stuff below
        if ( current_user_can('read')){
        if ( preg_match('#wp-admin/?(index.php)?$#', $_SERVER['REQUEST_URI']) ) {
     if ( function_exists('admin_url') ) {
     wp_redirect( admin_url('wp-admin/my-sites.php') );
     } else {
     wp_redirect( get_option('siteurl') . '/wp-admin/' . 'my-sites.php' );
     }
     }
     }

    I commented a line in there showing what I need to do - On log in I need users to go to their site I just have NO idea how to do it? And unsure if I can do it because some members are members of several sites...

    Any suggestions?

Topic Closed

This topic has been closed to new replies.

About this Topic