get_dashboard_url example


function wp_admin_bar_wp_menu( $wp_admin_bar ) {
    if ( current_user_can( 'read' ) ) {
        $about_url      = self_admin_url( 'about.php' );
        $contribute_url = self_admin_url( 'contribute.php' );
    } elseif ( is_multisite() ) {
        $about_url      = get_dashboard_url( get_current_user_id(), 'about.php' );
        $contribute_url = get_dashboard_url( get_current_user_id(), 'contribute.php' );
    } else {
        $about_url      = false;
        $contribute_url = false;
    }

    $wp_logo_menu_args = array(
        'id'    => 'wp-logo',
        'title' => '<span class="ab-icon" aria-hidden="true"></span><span class="screen-reader-text">' .
                /* translators: Hidden accessibility text. */
                __( 'About WordPress' ) .
            

function wp_admin_bar_dashboard_view_site_menu( $wp_admin_bar ) {
    _deprecated_function( __FUNCTION__, '3.3.0' );

    $user_id = get_current_user_id();

    if ( 0 != $user_id ) {
        if ( is_admin() )
            $wp_admin_bar->add_menu( array( 'id' => 'view-site', 'title' => __( 'Visit Site' ), 'href' => home_url() ) );
        elseif ( is_multisite() )
            $wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => get_dashboard_url( $user_id ) ) );
        else
            $wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => admin_url() ) );
    }
}

/** * Checks if the current user belong to a given site. * * @since MU (3.0.0) * @deprecated 3.3.0 Use is_user_member_of_blog() * @see is_user_member_of_blog() * * @param int $blog_id Site ID * @return bool True if the current users belong to $blog_id, false if not. */

function get_edit_profile_url( $user_id = 0, $scheme = 'admin' ) {
    $user_id = $user_id ? (int) $user_id : get_current_user_id();

    if ( is_user_admin() ) {
        $url = user_admin_url( 'profile.php', $scheme );
    } elseif ( is_network_admin() ) {
        $url = network_admin_url( 'profile.php', $scheme );
    } else {
        $url = get_dashboard_url( $user_id, 'profile.php', $scheme );
    }

    /** * Filters the URL for a user's profile editor. * * @since 3.1.0 * * @param string $url The complete URL including scheme and path. * @param int $user_id The user ID. * @param string $scheme Scheme to give the URL context. Accepts 'http', 'https', 'login', * 'login_post', 'admin', 'relative' or null. */

                        wp_login_url( $redirect_to )
                    );
                }
            }

            if ( ( empty( $redirect_to ) || 'wp-admin/' === $redirect_to || admin_url() === $redirect_to ) ) {
                // If the user doesn't belong to a blog, send them to user admin. If the user can't edit posts, send them to their profile.                 if ( is_multisite() && ! get_active_blog_for_user( $user->ID ) && ! is_super_admin( $user->ID ) ) {
                    $redirect_to = user_admin_url();
                } elseif ( is_multisite() && ! $user->has_cap( 'read' ) ) {
                    $redirect_to = get_dashboard_url( $user->ID );
                } elseif ( ! $user->has_cap( 'edit_posts' ) ) {
                    $redirect_to = $user->has_cap( 'read' ) ? admin_url( 'profile.php' ) : home_url();
                }

                wp_redirect( $redirect_to );
                exit;
            }

            wp_safe_redirect( $redirect_to );
            exit;
        }

        
Home | Imprint | This part of the site doesn't use cookies.