Disable User Dashboard at wp-admin

I want to disable user Dashboard access completley, normally this would work:

function no_mo_dashboard() {
if (!current_user_can('manage_options' )&& $_SERVER['DOING_AJAX'] != '/wp-admin/admin-ajax.php') {
wp_redirect(home_url()); exit;
}
}
add_action('admin_init', 'no_mo_dashboard');

But the Ultimate Facebook plugin doesn't log me in with 1-click login as soon as this is enabled. Is there a better way to do it ?

Also, is there a way to have Ultimate Facebook redirect user to /$username/profile/edit after sign-up (first 1-click login) ?

  • aecnu
    • WP Unicorn

    Greetings sevenmedia,

    Thank you for these great questions.

    I do not have the answer to this question and I certainly do not know everything.

    Therefore with that in mind, I will see if I can get the lead developer in here with his invaluable insight into this plugin for his advice/advise.

    Though this may take a bit longer then a normal ticket, I will try to get him in here asap.

    Cheers, Joe

  • Vladislav
    • Dead Eye Dev

    Hello,

    Instead of $_SERVER['DOING_AJAX'], you're really better off checking for "DOING_AJAX" define, like this:

    function no_mo_dashboard() {
    	if (!current_user_can('manage_options' ) && !(defined('DOING_AJAX') && DOING_AJAX)) {
    		wp_redirect(home_url()); exit;
    	}
    }
    add_action('admin_init', 'no_mo_dashboard');

    The code worked nicely for me, I hope this helps.

  • aecnu
    • WP Unicorn

    Greetings sevenmedia,

    Thank you again for another great question.

    And what about the /$username/profile/edit as the URL after first login ? Is the dynamic URL feature coming to the plugin anytime soon ?

    On this question I must report to you that it is standard WPMU Dev protocol ordered by the Big Boss that update releases, feature and plugin release dates or implementation dates are not to be given due to the amount of disappointment and criticism coming from members when the release did not happen when projected for whatever reason.

    However, if you have not already, please visit:
    http://wpmudev.uservoice.com/

    It might have already been suggested. It is worth a quick search to add your votes before submitting a new suggestion.

    The more popular a request is and the more votes it gets, the more likely it will be considered.

    Thank you for being a WPMU Dev member!

    Cheers, Joe :slight_smile:

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.