• Hello Folks!

    Hopefully I have this posted in the right place.. I’m a new user to WordPress and have been pretty impressed so far. I’ve managed to make a number of changes via custom functions and plug-ins so far but what seems like something very simple, seems to be defeating me.

    When my users log in, they don’t want to see the dashboard (we stripped it to dumb it down for our staff), instead we would rather have them go directly to the ‘Posts’ page.

    I know I can set in a redirect to do this but that affects pages so I started putting in some conditions. Such as if you are not an ADMIN and you are on the DASHBOARD page, then you should get redirected to the Posts page. But I can’t seem to get this done so I started to try and tackle smaller pieces such as just setting the redirect to happen if you are an ADMIN regardless of what page you are on.

    if ( is_super_admin($user_id) )
    	header("Location: http://????/wp-admin/edit.php");
    }

    (Sorry, I’m not ready for this to be seen yet so replaced the domain with ??? for now)

    Placing the above code in the top of the custom functions.php doesn’t seem to do anything. I tested this using an echo write just to see if it knew the difference and I was able to get good results, but the instant I placed the redirect URL in, I couldn’t seem to get it to execute. Funny thing is that the if statement on its own works fine … the redirect statement on its own works fine also. Together they don’t seem to work.

    Also, I played with this also but is this the right var to check if I want to see if I’m currently on the dashboard?

    $current_screen->id == dashboard

    Could really use some help here, thank you.

Viewing 1 replies (of 1 total)
  • you should wrap this in action ‘wp’ hack

    add_action('wp', 'myfunc');
    
    function myfunc() {
    if ( is_super_admin($user_id) )
    	header("Location: http://????/wp-admin/edit.php");
    }
    }

Viewing 1 replies (of 1 total)
  • The topic ‘Making Post the default page when logging in’ is closed to new replies.