Changeset 2088 for trunk/bp-core.php
- Timestamp:
- 11/13/2009 01:01:37 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core.php
r2077 r2088 533 533 * @uses get_usermeta() WordPress function to get the usermeta for a user. 534 534 */ 535 function bp_core_get_user_domain( $user_id ) {535 function bp_core_get_user_domain( $user_id, $user_nicename = false, $user_login = false ) { 536 536 global $bp; 537 537 538 538 if ( !$user_id ) return; 539 539 540 $ud = get_userdata($user_id); 540 if ( $domain = wp_cache_get( 'bp_user_domain_' . $user_id, 'bp' ) ) 541 return apply_filters( 'bp_core_get_user_domain', $domain ); 542 543 if ( !$user_nicename && !$user_login ) { 544 $ud = get_userdata($user_id); 545 $user_nicename = $ud->user_nicename; 546 $user_login = $ud->user_login; 547 } 541 548 542 549 if ( defined( 'BP_ENABLE_USERNAME_COMPATIBILITY_MODE' ) ) 543 $username = $u d->user_login;550 $username = $user_login; 544 551 else 545 $username = $u d->user_nicename;552 $username = $user_nicename; 546 553 547 554 /* If we are using a members slug, include it. */ 548 555 if ( !defined( 'BP_ENABLE_ROOT_PROFILES' ) ) 549 return apply_filters( 'bp_core_get_user_domain', $bp->root_domain . '/' . BP_MEMBERS_SLUG . '/' . $username . '/' );556 $domain = $bp->root_domain . '/' . BP_MEMBERS_SLUG . '/' . $username . '/'; 550 557 else 551 return apply_filters( 'bp_core_get_user_domain', $bp->root_domain . '/' . $username . '/' ); 558 $domain = $bp->root_domain . '/' . $username . '/'; 559 560 /* Cache the link */ 561 wp_cache_set( 'bp_user_domain_' . $user_id, $domain, 'bp' ); 562 563 return apply_filters( 'bp_core_get_user_domain', $domain ); 552 564 } 553 565 … … 721 733 } 722 734 add_action( 'wp_head', 'bp_core_sort_nav_items' ); 723 724 /**725 * bp_core_remove_nav_item()726 *727 * Removes a navigation item from the main navigation array.728 *729 * @package BuddyPress Core730 * @param $slug The slug of the sub navigation item.731 */732 function bp_core_remove_nav_item( $slug ) {733 global $bp;734 735 unset( $bp->bp_nav[$slug] );736 }737 735 738 736 /** … … 820 818 821 819 /** 822 * bp_core_remove_ subnav_item()820 * bp_core_remove_nav_item() 823 821 * 824 822 * Removes a navigation item from the sub navigation array used in BuddyPress themes. … … 828 826 * @param $slug The slug of the sub navigation item. 829 827 */ 828 function bp_core_remove_nav_item( $parent_id ) { 829 global $bp; 830 831 /* Unset subnav items for this nav item */ 832 foreach( $bp->bp_options_nav[$parent_id] as $subnav_item ) { 833 bp_core_remove_subnav_item( $parent_id, $subnav_item['slug'] ); 834 } 835 836 unset( $bp->bp_nav[$parent_id] ); 837 } 838 839 /** 840 * bp_core_remove_subnav_item() 841 * 842 * Removes a navigation item from the sub navigation array used in BuddyPress themes. 843 * 844 * @package BuddyPress Core 845 * @param $parent_id The id of the parent navigation item. 846 * @param $slug The slug of the sub navigation item. 847 */ 830 848 function bp_core_remove_subnav_item( $parent_id, $slug ) { 831 849 global $bp; 832 850 851 $function = $bp->bp_options_nav[$parent_id][$slug]['screen_function']; 852 853 if ( $function ) { 854 if ( !is_object( $screen_function[0] ) ) 855 remove_action( 'wp', $screen_function, 3 ); 856 else 857 remove_action( 'wp', array( &$screen_function[0], $screen_function[1] ), 3 ); 858 } 859 833 860 unset( $bp->bp_options_nav[$parent_id][$slug] ); 861 862 if ( !count( $bp->bp_options_nav[$parent_id] ) ) 863 unset($bp->bp_options_nav[$parent_id]); 834 864 } 835 865 … … 979 1009 global $bp; 980 1010 981 if ( !is_numeric($uid) ) 982 return false; 983 984 return apply_filters( 'bp_core_get_userurl', bp_core_get_user_domain( $uid ) ); 1011 if ( !$url = wp_cache_get( 'bp_user_url_' . $uid, 'bp' ) ) { 1012 $url = bp_core_get_user_domain( $uid ); 1013 } 1014 1015 return apply_filters( 'bp_core_get_userurl', $url ); 985 1016 } 986 1017 … … 997 1028 */ 998 1029 function bp_core_get_user_email( $uid ) { 999 $ud = get_userdata($uid); 1000 return apply_filters( 'bp_core_get_user_email', $ud->user_email ); 1030 if ( !$email = wp_cache_get( 'bp_user_email_' . $uid, 'bp' ) ) { 1031 $ud = get_userdata($uid); 1032 $email = $ud->user_email; 1033 } 1034 return apply_filters( 'bp_core_get_user_email', $email ); 1001 1035 } 1002 1036 … … 1031 1065 return false; 1032 1066 1033 if ( function_exists( 'bp_fetch_user_fullname') ) {1067 if ( function_exists( 'bp_core_get_user_displayname' ) ) { 1034 1068 $display_name = bp_core_get_user_displayname( $user_id ); 1035 1069 … … 1050 1084 return $url; 1051 1085 1052 return '<a href="' . $url . '">' . $display_name . '</a>';1086 return apply_filters( 'bp_core_get_userlink', '<a href="' . $url . '">' . $display_name . '</a>', $user_id ); 1053 1087 } 1054 1088 … … 1666 1700 global $wpdb; 1667 1701 ?> 1668 <!-- Generated in <?php timer_stop(1); ?> seconds. -->1702 <!-- Generated in <?php timer_stop(1); ?> seconds. <?php echo get_num_queries(); ?> --> 1669 1703 <?php 1670 1704 }
Note: See TracChangeset
for help on using the changeset viewer.