Changeset 16083 for trunk/wp-includes/link-template.php
- Timestamp:
- 10/29/2010 05:48:53 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/link-template.php
r16030 r16083 2272 2272 2273 2273 /** 2274 * Get the URL to the user's dashboard. 2275 * 2276 * If a user does not belong to any sites, the global user dashboard is used. If the user belongs to the current site, 2277 * the dashboard for the current site is returned. If the user cannot edit the current site, the dashboard to the user's 2278 * primary blog is returned. 2279 * 2280 * @since 3.1.0 2281 * 2282 * @param int $user_id User ID 2283 * @param string $path Optional path relative to the dashboard. Use only paths known to both blog and user admins. 2284 * @param string $scheme The scheme to use. Default is 'admin', which obeys force_ssl_admin() and is_ssl(). 'http' or 'https' can be passed to force those schemes. 2285 * @return string Dashboard url link with optional path appended 2286 */ 2287 function get_dashboard_url( $user_id, $path = '', $scheme = 'admin' ) { 2288 $user_id = (int) $user_id; 2289 2290 $blogs = get_blogs_of_user( $user_id ); 2291 if ( empty($blogs) ) { 2292 $url = user_admin_url( $path, $scheme ); 2293 } elseif ( ! is_multisite() ) { 2294 $url = admin_url( $path, $scheme ); 2295 } else { 2296 $current_blog = get_current_blog_id(); 2297 if ( $current_blog && in_array($current_blog, array_keys($blogs)) ) { 2298 $url = admin_url( $path, $scheme ); 2299 } else { 2300 $active = get_active_blog_for_user( $user_id ); 2301 if ( $active ) 2302 $url = get_admin_url( $active->blog_id, $path, $scheme ); 2303 else 2304 $url = user_admin_url( $path, $scheme ); 2305 } 2306 } 2307 2308 return apply_filters( 'user_dashboard_url', $url, $user_id, $path, $scheme); 2309 } 2310 2311 /** 2312 * Get the URL to the user's profile editor. 2313 * 2314 * @since 3.1.0 2315 * 2316 * @param int $user User ID 2317 * @param string $scheme The scheme to use. Default is 'admin', which obeys force_ssl_admin() and is_ssl(). 'http' or 'https' can be passed to force those schemes. 2318 * @return string Dashboard url link with optional path appended 2319 */ 2320 function get_edit_profile_url( $user, $scheme = 'admin' ) { 2321 $user = (int) $user; 2322 2323 $url = get_dashboard_url( $user, 'profile.php', $scheme ); 2324 2325 return apply_filters( 'edit_profile_url', $url, $user, $scheme); 2326 } 2327 2328 /** 2274 2329 * Output rel=canonical for singular queries 2275 2330 *
Note: See TracChangeset
for help on using the changeset viewer.