• Hello,
    This is trickier than it seems… please read whole thing:

    Requirements:
    1) do not allow a user to view a dashboard, rather redirect users to the /user/page/
    2) do not prevent user activity/fuctions/user logic from happening (ex: submitting data, forms, uploading images, etc etc).

    NOTE: it seems many user processes need wp-admin files??? which is currently giving me the problems ??

    3) allow admin users to view the admin dashboard

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter sayze35

    (@sayze35)

    Question is there a difference between allowing a user (meaning a subscriber) to “execute” wp-admin code/files AND being able to “read” or view the wp-admin/ pages?

    Thread Starter sayze35

    (@sayze35)

    this is working:

    function checkFunc()
    {
    	global $pagenow;
        if ( 'index.php' == $pagenow or 'profile.php' == $pagenow ) {
    
            if ( ! current_user_can( 'manage_options' ) && ( ! wp_doing_ajax() ) ) {
                error_log(" ##### breakin ##### admin access blocked this user IP:".getUserIpAddr());
                wp_safe_redirect( site_url() ); 
                exit;
            }
        }
        
    }
    //add_action('plugins_loaded', 'checkFunc');
    add_action( 'admin_init', 'checkFunc', 1 );

    BUT surely that is NOT the way to do it?

    I saw multiple ‘wrong’ ways or ways that don’t work out on the internet.
    THERE must be a simple, easy and full-proof way to prevent subscribers from seeing the dashboard? The above way is not full proof.

    IF admin, they can see or do whatever.
    IF subscriber, they can ONLY be redirected to the /subcriber/page/
    AND they need to be able to upload, submit, etc. etc. without being blocked.

    I just need to prevent subscribers from “viewing” the wp-admin pages, NOT preventing them from executing/using WP code or functionality. Can that happen? How?

    thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘how to NOT show a dashboard for regular user’ is closed to new replies.