get_dashboard_url [ WordPress Function ]
| Parameters: |
|
| Returns: |
|
| Defined at: |
|
Get the URL to the user's dashboard.
If a user does not belong to any site, the global user dashboard is used. If the user belongs to the current site, the dashboard for the current site is returned. If the user cannot edit the current site, the dashboard to the user's primary blog is returned.
Source
<?php
function get_dashboard_url( $user_id, $path = '', $scheme = 'admin' ) {
$user_id = (int) $user_id;
$blogs = get_blogs_of_user( $user_id );
if ( ! is_super_admin() && empty($blogs) ) {
$url = user_admin_url( $path, $scheme );
} elseif ( ! is_multisite() ) {
$url = admin_url( $path, $scheme );
} else {
$current_blog = get_current_blog_id();
if ( $current_blog && ( is_super_admin( $user_id ) || in_array( $current_blog, array_keys( $blogs ) ) ) ) {
$url = admin_url( $path, $scheme );
} else {
$active = get_active_blog_for_user( $user_id );
if ( $active )
$url = get_admin_url( $active->blog_id, $path, $scheme );
else
$url = user_admin_url( $path, $scheme );
}
}
return apply_filters( 'user_dashboard_url', $url, $user_id, $path, $scheme);
}
?>
Examples [ wp-snippets.com ]
Top Google zoekresultaten
- get_dashboard_url - Function Reference - PHP Cross Reference ...
Jun 1, 2011 ... Function and Method Cross Reference. get_dashboard_url(). Defined at: /wp- includes/link-template.php -> line 2287. Referenced 4 times: ...
xref.yoast.com - get_dashboard_url | A HitchHackers guide through WordPress
Feb 24, 2011 ... If a user does not belong to any site, the global user dashboard is used. If the user belongs to the current site, the dashboard for the current site ...
hitchhackerguide.com - get_dashboard_url() WordPress function reference, arguments and ...
get_dashboard_url(). Get the URL to the user's dashboard. If a user does not belong to any site, the global user dashboard is used. If the user belongs to the ...
queryposts.com - #16686 ($user argument of get_edit_profile_url() should be optional ...
Looking at it further, the same treatment can probably be applied to get_dashboard_url(), in fact we can just put the logic there, and pass $user_id = 0 right into ...
core.trac.wordpress.org