Skip to:
Content

BuddyPress.org

Changeset 1518


Ignore:
Timestamp:
06/05/2009 09:29:24 PM (16 years ago)
Author:
apeatling
Message:

Streamlined the multiple functions to get the user's name, and brought them under the new "bp_core_get_user_displayname" function.

Added more through commenting to the bp-core.php file.

Allowed greater customization to bp_core_action_search_site()

Added bp_get_buddypress_theme_path() and bp_get_buddypress_theme_uri() functions

Reduced priority on some core BuddyPress functions, so that other plugins can scoot in front if needed.

Added missing filters on some core functions.

Location:
trunk
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-blogs.php

    r1506 r1518  
    195195    }
    196196}
    197 add_action( 'wp', 'bp_blogs_directory_blogs_setup', 5 );
     197add_action( 'wp', 'bp_blogs_directory_blogs_setup', 2 );
    198198
    199199function bp_blogs_screen_my_blogs() {
     
    758758            $member_theme = 'bpmember';
    759759
    760         add_filter( 'theme_root', 'bp_core_set_member_theme_root' );
    761         add_filter( 'theme_root_uri', 'bp_core_set_member_theme_root_uri' );
     760        add_filter( 'theme_root', 'bp_core_filter_buddypress_theme_root' );
     761        add_filter( 'theme_root_uri', 'bp_core_filter_buddypress_theme_root_uri' );
    762762
    763763        return $member_theme;
     
    777777            $member_theme = 'bpmember';
    778778
    779         add_filter( 'theme_root', 'bp_core_set_member_theme_root' );
    780         add_filter( 'theme_root_uri', 'bp_core_set_member_theme_root_uri' );
     779        add_filter( 'theme_root', 'bp_core_filter_buddypress_theme_root' );
     780        add_filter( 'theme_root_uri', 'bp_core_filter_buddypress_theme_root_uri' );
    781781
    782782        return $member_theme;
  • trunk/bp-core.php

    r1515 r1518  
    3838require ( BP_PLUGIN_DIR . '/bp-core/bp-core-notifications.php' );
    3939
     40/* If BP_DISABLE_ADMIN_BAR is defined, do not load the global admin bar */
    4041if ( !defined( 'BP_DISABLE_ADMIN_BAR') )
    4142    require ( 'bp-core/bp-core-adminbar.php' );
     
    139140   
    140141    /* Fetch the full name for the logged in and current user */
    141     $bp->loggedin_user->fullname = bp_core_global_user_fullname( $bp->loggedin_user->id );
    142     $bp->displayed_user->fullname = bp_core_global_user_fullname( $bp->displayed_user->id );
     142    $bp->loggedin_user->fullname = bp_core_get_user_displayname( $bp->loggedin_user->id );
     143    $bp->displayed_user->fullname = bp_core_get_user_displayname( $bp->displayed_user->id );
    143144
    144145    /* Used to determine if user has admin rights on current content. If the logged in user is viewing
     
    158159}
    159160add_action( 'plugins_loaded', 'bp_core_setup_globals', 3 );
    160 add_action( '_admin_menu', 'bp_core_setup_globals', 1 ); // must be _admin_menu hook.
    161 
    162 function bp_core_setup_root_components() {
     161add_action( '_admin_menu', 'bp_core_setup_globals', 3 ); // must be _admin_menu hook.
     162
     163
     164/**
     165 * bp_core_setup_root_uris()
     166 *
     167 * Adds the core URIs that should run in the root of the installation.
     168 *
     169 * For example: http://example.org/search or http://example.org/members
     170 *
     171 * @package BuddyPress Core
     172 * @uses bp_core_add_root_component() Adds a slug to the root components global variable.
     173 */
     174function bp_core_setup_root_uris() {
    163175    /* Add core root components */
    164176    bp_core_add_root_component( BP_MEMBERS_SLUG );
     
    168180    bp_core_add_root_component( BP_HOME_BLOG_SLUG );
    169181}
    170 add_action( 'plugins_loaded', 'bp_core_setup_root_components', 1 );
    171 
    172 function bp_core_setup_cookies() {
    173     global $bp_message, $bp_message_type;
    174    
    175     // Render any error/success feedback on the template
    176     if ( $_COOKIE['bp-message'] == '' || !isset( $_COOKIE['bp-message'] ) )
    177         return false;
    178 
    179     $bp_message = $_COOKIE['bp-message'];
    180     $bp_message_type = $_COOKIE['bp-message-type'];
    181     add_action( 'template_notices', 'bp_core_render_notice' );
    182 
    183     setcookie( 'bp-message', false, time() - 1000, COOKIEPATH );
    184     setcookie( 'bp-message-type', false, time() - 1000, COOKIEPATH );
    185 }
    186 add_action( 'wp', 'bp_core_setup_cookies', 3 );
    187 
     182add_action( 'plugins_loaded', 'bp_core_setup_root_uris', 2 );
     183
     184
     185/**
     186 * bp_core_install()
     187 *
     188 * Installs the core DB tables for BuddyPress.
     189 *
     190 * @package BuddyPress Core
     191 * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
     192 * @global $wpdb WordPress DB access object.
     193 * @uses dbDelta() Performs a table creation, or upgrade based on what already exists in the DB.
     194 * @uses bp_core_add_illegal_names() Adds illegal blog names to the WP settings
     195 */
    188196function bp_core_install() {
    189197    global $wpdb, $bp;
     
    250258add_action( 'admin_menu', 'bp_core_check_installed' );
    251259
     260
     261/**
     262 * bp_core_setup_cookies()
     263 *
     264 * Checks if there is a feedback message in the WP cookie, if so, adds a "template_notices" action
     265 * so that the message can be parsed into the template and displayed to the user.
     266 *
     267 * After the message is displayed, it removes the message vars from the cookie so that the message
     268 * is not shown to the user multiple times.
     269 *
     270 * @package BuddyPress Core
     271 * @global $bp_message The message text
     272 * @global $bp_message_type The type of message (error/success)
     273 * @uses setcookie() Sets a cookie value for the user.
     274 */
     275function bp_core_setup_cookies() {
     276    global $bp_message, $bp_message_type;
     277   
     278    // Render any error/success feedback on the template
     279    if ( $_COOKIE['bp-message'] == '' || !isset( $_COOKIE['bp-message'] ) )
     280        return false;
     281
     282    $bp_message = $_COOKIE['bp-message'];
     283    $bp_message_type = $_COOKIE['bp-message-type'];
     284    add_action( 'template_notices', 'bp_core_render_notice' );
     285
     286    setcookie( 'bp-message', false, time() - 1000, COOKIEPATH );
     287    setcookie( 'bp-message-type', false, time() - 1000, COOKIEPATH );
     288}
     289add_action( 'init', 'bp_core_setup_cookies' );
     290
     291
    252292/**
    253293 * bp_core_add_admin_menu()
     
    328368add_action( 'admin_menu', 'bp_core_setup_nav', 2 );
    329369
    330 function bp_core_directory_members() {
     370/**
     371 * bp_core_action_directory_members()
     372 *
     373 * Listens to the $bp component and action variables to determine if the user is viewing the members
     374 * directory page. If they are, it will set up the directory and load the members directory template.
     375 *
     376 * @package BuddyPress Core
     377 * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
     378 * @uses wp_enqueue_script() Loads a JS script into the header of the page.
     379 * @uses bp_core_load_template() Loads a specific template file.
     380 */
     381function bp_core_action_directory_members() {
    331382    global $bp;
    332383   
     
    339390    }
    340391}
    341 add_action( 'wp', 'bp_core_directory_members', 5 );
     392add_action( 'wp', 'bp_core_action_directory_members', 2 );
    342393
    343394/**
     
    486537   
    487538    if ( function_exists($function) && $user_has_access && $bp->current_action == $slug && $bp->current_component == $parent_id )
    488         add_action( 'wp', $function, 3 );
     539        add_action( 'wp', $function );
    489540}
    490541
     
    543594    if ( $bp->current_component == $parent_id && !$bp->current_action ) {
    544595        if ( function_exists($function) ) {
    545             add_action( 'wp', $function, 3 );
     596            add_action( 'wp', $function );
    546597        }
    547598       
     
    635686    global $wpdb;
    636687   
    637     $sql = $wpdb->prepare( "SELECT ID FROM " . CUSTOM_USER_TABLE . " WHERE user_login = %s", $username );
    638     return $wpdb->get_var($sql);
    639 }
    640 
    641 /**
    642  * bp_core_get_userid_from_user_login()
    643  *
    644  * Returns the user_id from a user login
    645  * @package BuddyPress Core
    646  * @param $path str Path to check.
    647  * @global $wpdb WordPress DB access object.
    648  * @return false on no match
    649  * @return int the user ID of the matched user.
    650  */
    651 function bp_core_get_userid_from_user_login( $user_login ) {
    652     global $wpdb;
    653 
    654     if ( !empty( $user_login ) )
    655         return $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM " . CUSTOM_USER_TABLE . " WHERE user_login = %s", $user_login ) );
    656 }
     688    if ( !empty( $username ) )
     689        return apply_filters( 'bp_core_get_userid', $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM " . CUSTOM_USER_TABLE . " WHERE user_login = %s", $username ) ) );
     690}
     691    function bp_core_get_userid_from_user_login( $deprecated ) {
     692        return bp_core_get_userid( $deprecated );
     693    }
    657694
    658695/**
     
    672709   
    673710    if ( $uid == $userdata->ID )
    674         return __( 'You', 'buddypress' );
     711        $username = __( 'You', 'buddypress' );
    675712   
    676713    if ( !$ud = get_userdata($uid) )
    677714        return false;
    678715       
    679     return $ud->user_login;
     716    $username = $ud->user_login;   
     717
     718    return apply_filters( 'bp_core_get_username', $username );
    680719}
    681720
     
    700739    $ud = get_userdata($uid);
    701740       
    702     return $bp->root_domain . '/' . BP_MEMBERS_SLUG . '/' . $ud->user_login . '/';
     741    return apply_filters( 'bp_core_get_userurl', $bp->root_domain . '/' . BP_MEMBERS_SLUG . '/' . $ud->user_login . '/' );
    703742}
    704743
     
    716755function bp_core_get_user_email( $uid ) {
    717756    $ud = get_userdata($uid);
    718     return $ud->user_email;
     757    return apply_filters( 'bp_core_get_user_email', $ud->user_email );
    719758}
    720759
     
    750789
    751790    if ( function_exists('bp_fetch_user_fullname') ) {
    752         $display_name = bp_fetch_user_fullname( $user_id, false );
     791        $display_name = bp_core_get_user_displayname( $user_id );
    753792       
    754793        if ( $with_s )
     
    759798    }
    760799   
    761     // if ( $user_id == $userdata->ID && !$no_you )
    762     //  $display_name = 'You';
    763    
    764800    if ( $no_anchor )
    765801        return $display_name;
     
    774810}
    775811
    776 /**
    777  * bp_core_global_user_fullname()
    778  *
    779  * Returns the full name for the user, or the display name if Xprofile component is not installed.
    780  *
    781  * @package BuddyPress Core
    782  * @param $user_id string The user ID of the user.
    783  * @param
    784  * @uses bp_fetch_user_fullname() Returns the full name for a user based on user ID.
    785  * @uses get_userdata() Fetches a new userdata object for the user ID passed.
    786  * @return Either the users full name, or the display name.
    787  */
    788 function bp_core_global_user_fullname( $user_id ) {
    789     if ( function_exists('bp_fetch_user_fullname') ) {
    790         return bp_fetch_user_fullname( $user_id, false );
    791     } else {
    792         $ud = get_userdata($user_id);
    793         return $current_user->display_name;
    794     }
    795 }
     812
     813/**
     814 * bp_core_get_user_displayname()
     815 *
     816 * Fetch the display name for a user. This will use the "Name" field in xprofile if it is installed.
     817 * Otherwise, it will fall back to the normal WP display_name, or user_nicename, depending on what has been set.
     818 *
     819 * @package BuddyPress Core
     820 * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
     821 * @uses wp_cache_get() Will try and fetch the value from the cache, rather than querying the DB again.
     822 * @uses get_userdata() Fetches the WP userdata for a specific user.
     823 * @uses xprofile_set_field_data() Will update the field data for a user based on field name and user id.
     824 * @uses wp_cache_set() Adds a value to the cache.
     825 * @return str The display name for the user in question.
     826 */
     827function bp_core_get_user_displayname( $user_id ) {
     828    global $bp;
     829   
     830    if ( !$user_id )
     831        return false;
     832       
     833    if ( !$fullname = wp_cache_get( 'bp_user_fullname_' . $user_id, 'bp' ) ) {
     834        if ( function_exists('xprofile_install') ) {
     835            $fullname = xprofile_get_field_data( BP_XPROFILE_FULLNAME_FIELD_NAME, $user_id );
     836
     837            if ( empty($fullname) || !$fullname ) {
     838                $ud = get_userdata($user_id);
     839
     840                if ( empty( $ud->display_name ) )
     841                    $fullname = $ud->user_nicename;
     842                else
     843                    $fullname = $ud->display_name;
     844
     845                xprofile_set_field_data( BP_XPROFILE_FULLNAME_FIELD_NAME, $user_id, $fullname );
     846            }
     847        } else {
     848            $ud = get_userdata($user_id);
     849            $fullname = $ud->display_name;
     850        }
     851
     852        wp_cache_set( 'bp_user_fullname_' . $user_id, $fullname, 'bp' );
     853    }
     854   
     855    return apply_filters( 'bp_core_get_user_displayname', stripslashes( trim( $fullname ) ) );
     856}
     857    /* DEPRECATED Use: bp_core_get_user_displayname */
     858    function bp_core_global_user_fullname( $user_id ) { return bp_core_get_user_displayname( $user_id ); }
     859
    796860
    797861/**
     
    811875}
    812876
     877
    813878/**
    814879 * bp_core_get_userlink_by_username()
     
    827892    return apply_filters( 'bp_core_get_userlink_by_username', bp_core_get_userlink( $user_id, false, false, true ) );
    828893}
     894
    829895
    830896/**
     
    849915}
    850916
     917
     918/**
     919 * bp_core_add_message()
     920 *
     921 * Adds a feedback (error/success) message to the WP cookie so it can be displayed after the page reloads.
     922 *
     923 * @package BuddyPress Core
     924 */
    851925function bp_core_add_message( $message, $type = false ) {
    852926    if ( !$type )
     
    856930    setcookie( 'bp-message-type', $type, time()+60*60*24, COOKIEPATH );
    857931}
     932
    858933
    859934/**
     
    878953}
    879954
     955
    880956/**
    881957 * bp_core_time_since()
     
    9541030    return $output;
    9551031}
     1032
    9561033
    9571034/**
     
    10071084}
    10081085
     1086
    10091087/**
    10101088 * bp_core_get_all_posts_for_user()
     
    10261104}
    10271105
     1106
    10281107/**
    10291108 * bp_core_get_site_path()
     
    10411120}
    10421121
     1122/**
     1123 * bp_core_redirect()
     1124 *
     1125 * Performs a status safe wp_redirect() that is compatible with bp_catch_uri()
     1126 *
     1127 * @package BuddyPress Core
     1128 * @global $bp_no_status_set Makes sure that there are no conflicts with status_header() called in bp_core_do_catch_uri()
     1129 * @uses get_themes()
     1130 * @return An array containing all of the themes.
     1131 */
    10431132function bp_core_redirect( $location, $status = 302 ) {
    10441133    global $bp_no_status_set;
     
    11291218}
    11301219
    1131 function bp_core_get_member_themes() {
    1132     add_filter( 'theme_root', 'bp_core_set_member_theme_root' );
     1220/**
     1221 * bp_core_get_buddypress_themes()
     1222 *
     1223 * Gets an array of all the BuddyPress themes in the /bp-themes/ directory.
     1224 *
     1225 * @package BuddyPress Core
     1226 * @uses get_themes()
     1227 * @return An array containing all of the themes.
     1228 */
     1229function bp_core_get_buddypress_themes() {
     1230    add_filter( 'theme_root', 'bp_core_filter_buddypress_theme_root' );
    11331231    $themes = get_themes();
    11341232
     
    11481246    return $member_themes;
    11491247}
    1150 
    1151 function bp_core_set_member_theme_root() {
    1152     return apply_filters( 'bp_core_set_member_theme_root', WP_CONTENT_DIR . "/bp-themes" );
    1153 }
    1154 
    1155 function bp_core_set_member_theme_root_uri() {
    1156     return apply_filters( 'bp_core_set_member_theme_root_uri', WP_CONTENT_URL . '/bp-themes' );
    1157 }
    1158 
     1248function bp_core_get_member_themes() { return bp_core_get_buddypress_themes(); } // DEPRECATED
     1249
     1250
     1251/**
     1252 * bp_get_buddypress_theme_uri()
     1253 *
     1254 * Get the url of the selected BuddyPress theme.
     1255 *
     1256 * @package BuddyPress Core
     1257 */
     1258function bp_get_buddypress_theme_uri() {
     1259    return apply_filters( 'bp_get_buddypress_theme_uri', WP_CONTENT_URL . '/bp-themes/' . get_site_option( 'active-member-theme' ) );
     1260}
     1261
     1262
     1263/**
     1264 * bp_get_buddypress_theme_path()
     1265 *
     1266 * Get the path of the selected BuddyPress theme.
     1267 *
     1268 * @package BuddyPress Core
     1269 */
     1270function bp_get_buddypress_theme_path() {
     1271    return apply_filters( 'bp_get_buddypress_theme_path', WP_CONTENT_DIR . '/bp-themes/' . get_site_option( 'active-member-theme' ) );
     1272}
     1273
     1274
     1275/**
     1276 * bp_core_filter_buddypress_theme_root()
     1277 *
     1278 * Adds a filter that changes the root path of the theme directory to the bp-themes directory.
     1279 *
     1280 * @package BuddyPress Core
     1281 */
     1282function bp_core_filter_buddypress_theme_root() {
     1283    return apply_filters( 'bp_core_filter_buddypress_theme_root', WP_CONTENT_DIR . "/bp-themes" );
     1284}
     1285
     1286
     1287/**
     1288 * bp_core_filter_buddypress_theme_root_uri()
     1289 *
     1290 * Adds a filter that changes the root URI of the theme directory to the bp-themes directory.
     1291 *
     1292 * @package BuddyPress Core
     1293 */
     1294function bp_core_filter_buddypress_theme_root_uri() {
     1295    return apply_filters( 'bp_core_filter_buddypress_theme_root_uri', WP_CONTENT_URL . '/bp-themes' );
     1296}
     1297
     1298
     1299/**
     1300 * bp_core_add_illegal_names()
     1301 *
     1302 * Adds illegal names to WP so that root components will not conflict with
     1303 * blog names on a subdirectory installation.
     1304 *
     1305 * For example, it would stop someone creating a blog with the slug "groups".
     1306 *
     1307 * @package BuddyPress Core
     1308 * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
     1309 */
    11591310function bp_core_add_illegal_names() {
    11601311    global $bp;
     
    11921343add_filter( 'wp_mail_from_name', 'bp_core_email_from_name_filter' );
    11931344
     1345
    11941346/**
    11951347 * bp_core_email_from_name_filter()
     
    12081360
    12091361
     1362/**
     1363 * bp_core_delete_account()
     1364 *
     1365 * Allows a user to completely remove their account from the system
     1366 *
     1367 * @package BuddyPress Core
     1368 * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
     1369 * @uses check_admin_referer() Checks for a valid security nonce.
     1370 * @uses is_site_admin() Checks to see if the user is a site administrator.
     1371 * @uses wpmu_delete_user() Deletes a user from the system.
     1372 */
    12101373function bp_core_delete_account() {
    12111374    global $bp;
    12121375
    12131376    // Be careful with this function!
     1377   
     1378    if ( !check_admin_referer( 'delete-account' ) )
     1379        return false;
     1380   
     1381    /* Site admins should not be allowed to delete their accounts */
     1382    if ( is_site_admin() )
     1383        return false;
    12141384   
    12151385    require_once( ABSPATH . '/wp-admin/includes/mu.php' );
     
    12191389}
    12201390
    1221 function bp_core_search_site() {
    1222     global $bp;
    1223    
     1391
     1392/**
     1393 * bp_core_search_site()
     1394 *
     1395 * A javascript free implementation of the search functions in BuddyPress
     1396 *
     1397 * @package BuddyPress Core
     1398 * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
     1399 * @param $slug The slug to redirect to for searching.
     1400 */
     1401function bp_core_action_search_site( $slug = false ) {
     1402    global $bp;
     1403
    12241404    if ( $bp->current_component == BP_SEARCH_SLUG ) {
    12251405        $search_terms = $_POST['search-terms'];
    12261406        $search_which = $_POST['search-which'];
    12271407       
    1228         switch ( $search_which ) {
    1229             case 'members': default:
    1230                 $search = BP_MEMBERS_SLUG;
    1231                 break;
    1232             case 'groups':
    1233                 $search = BP_GROUPS_SLUG;
    1234                 break;
    1235             case 'blogs':
    1236                 $search = BP_BLOGS_SLUG;
    1237                 break;
     1408        if ( !$slug || empty( $slug ) ) {
     1409            switch ( $search_which ) {
     1410                case 'members': default:
     1411                    $slug = BP_MEMBERS_SLUG;
     1412                    break;
     1413                case 'groups':
     1414                    $slug = BP_GROUPS_SLUG;
     1415                    break;
     1416                case 'blogs':
     1417                    $slug = BP_BLOGS_SLUG;
     1418                    break;
     1419            }
    12381420        }
    1239        
    1240         $search_url = apply_filters( 'bp_core_search_site', site_url( $search . '/?s=' . urlencode($search_terms) ), $search_terms );
     1421
     1422        $search_url = apply_filters( 'bp_core_search_site', site_url( $slug . '/?s=' . urlencode($search_terms) ), $search_terms );
    12411423       
    12421424        bp_core_redirect( $search_url );
    12431425    }
    12441426}
    1245 add_action( 'wp', 'bp_core_search_site', 5 );
     1427add_action( 'init', 'bp_core_action_search_site', 5 );
     1428
    12461429
    12471430/**
    12481431 * bp_core_ucfirst()
    12491432 *
    1250  * Localization save ucfirst() support.
     1433 * Localization safe ucfirst() support.
    12511434 *
    12521435 * @package BuddyPress Core
     
    12611444}
    12621445
     1446
    12631447/**
    12641448 * bp_core_strip_username_spaces()
     
    12721456}
    12731457add_action( 'pre_user_login', 'bp_core_strip_username_spaces' );
     1458
    12741459
    12751460/**
     
    12921477}
    12931478
    1294 function bp_core_print_version_numbers() {
    1295     global $bp;
    1296    
    1297     foreach ( $bp->version_numbers as $name => $version ) {
    1298         echo ucwords($name) . ': <b>' . $version . '</b> / ';
    1299     }
    1300 }
    1301 
     1479/**
     1480 * bp_core_print_generation_time()
     1481 *
     1482 * Prints the generation time in the footer of the site.
     1483 *
     1484 * @package BuddyPress Core
     1485 */
    13021486function bp_core_print_generation_time() {
    13031487    global $wpdb;
     
    13281512add_action( 'delete_user', 'bp_core_remove_data', 1 );
    13291513
     1514
     1515/**
     1516 * bp_core_clear_user_object_cache()
     1517 *
     1518 * Clears all cached objects for a user, or a user is part of.
     1519 *
     1520 * @package BuddyPress Core
     1521 */
    13301522function bp_core_clear_user_object_cache( $user_id ) {
    13311523    wp_cache_delete( 'bp_user_' . $user_id, 'bp' );
  • trunk/bp-core/bp-core-admin.php

    r1473 r1518  
    8989                    <th scope="row"><?php _e('Select theme to use for BuddyPress generated pages', 'buddypress' ) ?>:</th>
    9090                    <td>
    91                         <?php $themes = bp_core_get_member_themes() ?>
     91                        <?php $themes = bp_core_get_buddypress_themes() ?>
    9292                        <?php if ( $themes ) : ?>
    9393                        <select name="bp-admin[active-member-theme]" id="active-member-theme">
  • trunk/bp-core/bp-core-catchuri.php

    r1501 r1518  
    280280    if ( $is_member_page ) {
    281281
    282         add_filter( 'theme_root', 'bp_core_set_member_theme_root' );
    283         add_filter( 'theme_root_uri', 'bp_core_set_member_theme_root_uri' );
     282        add_filter( 'theme_root', 'bp_core_filter_buddypress_theme_root' );
     283        add_filter( 'theme_root_uri', 'bp_core_filter_buddypress_theme_root_uri' );
    284284
    285285        return $member_theme;
     
    299299
    300300    if ( $is_member_page ) {
    301         add_filter( 'theme_root', 'bp_core_set_member_theme_root' );
    302         add_filter( 'theme_root_uri', 'bp_core_set_member_theme_root_uri' );
     301        add_filter( 'theme_root', 'bp_core_filter_buddypress_theme_root' );
     302        add_filter( 'theme_root_uri', 'bp_core_filter_buddypress_theme_root_uri' );
    303303
    304304        return $member_theme;
  • trunk/bp-core/bp-core-classes.php

    r1408 r1518  
    6363        $this->user_link = bp_core_get_userlink( $this->id );
    6464       
    65         $this->fullname = bp_fetch_user_fullname( $this->id, false );
     65        $this->fullname = bp_core_get_user_displayname( $this->id );
    6666        $this->email = bp_core_get_user_email( $this->id );
    6767        $this->last_active = bp_core_get_last_activity( get_usermeta( $this->id, 'last_activity' ), __( 'active %s ago', 'buddypress' ) );
  • trunk/bp-core/bp-core-settings.php

    r1473 r1518  
    99    bp_core_add_subnav_item( 'settings', 'general', __('General', 'buddypress'), $bp->loggedin_user->domain . 'settings/', 'bp_core_screen_general_settings', false, bp_is_home() );
    1010    bp_core_add_subnav_item( 'settings', 'notifications', __('Notifications', 'buddypress'), $bp->loggedin_user->domain . 'settings/', 'bp_core_screen_notification_settings', false, bp_is_home() );
    11     bp_core_add_subnav_item( 'settings', 'delete-account', __('Delete Account', 'buddypress'), $bp->loggedin_user->domain . 'settings/', 'bp_core_screen_delete_account', false, bp_is_home() );
     11   
     12    if ( !is_site_admin() )
     13        bp_core_add_subnav_item( 'settings', 'delete-account', __('Delete Account', 'buddypress'), $bp->loggedin_user->domain . 'settings/', 'bp_core_screen_delete_account', false, bp_is_home() );
    1214}
    1315add_action( 'wp', 'bp_core_add_settings_nav', 2 );
  • trunk/bp-core/bp-core-templatetags.php

    r1510 r1518  
    231231}
    232232
     233/* DEPRECATED Use: bp_core_get_user_displayname() */
    233234function bp_fetch_user_fullname( $user_id, $echo = true ) {
    234     global $bp;
    235    
    236     if ( !$user_id )
    237         return false;
    238        
    239     if ( !$fullname = wp_cache_get( 'bp_user_fullname_' . $user_id, 'bp' ) ) {
    240         if ( function_exists('xprofile_install') ) {
    241             $fullname = xprofile_get_field_data( BP_XPROFILE_FULLNAME_FIELD_NAME, $user_id );
    242 
    243             if ( empty($fullname) || !$fullname ) {
    244                 $ud = get_userdata($user_id);
    245 
    246                 if ( empty( $ud->display_name ) )
    247                     $fullname = $ud->user_nicename;
    248                 else
    249                     $fullname = $ud->display_name;
    250 
    251                 xprofile_set_field_data( BP_XPROFILE_FULLNAME_FIELD_NAME, $user_id, $fullname );
    252             }
    253         } else {
    254             $ud = get_userdata($user_id);
    255             $fullname = $ud->display_name;
    256         }
    257 
    258         wp_cache_set( 'bp_user_fullname_' . $user_id, $fullname, 'bp' );
    259     }
    260 
    261235    if ( $echo )
    262         echo apply_filters( 'bp_fetch_user_fullname', stripslashes( trim( $fullname ) ) );
     236        echo apply_filters( 'bp_fetch_user_fullname', bp_core_get_user_displayname( $user_id ) );
    263237    else
    264         return apply_filters( 'bp_fetch_user_fullname', stripslashes ( trim ( $fullname ) ) );
     238        return apply_filters( 'bp_fetch_user_fullname', bp_core_get_user_displayname( $user_id ) );
    265239}
    266240
  • trunk/bp-core/bp-core-widgets.php

    r1486 r1518  
    183183        <?php foreach ( (array) $users['users'] as $user ) : ?>
    184184            <div class="item-avatar">
    185                 <a href="<?php echo bp_core_get_userurl($user->user_id) ?>" title="<?php bp_fetch_user_fullname( $user->user_id, true ) ?>"><?php echo bp_core_get_avatar( $user->user_id, 1 ) ?></a>
     185                <a href="<?php echo bp_core_get_userurl($user->user_id) ?>" title="<?php echo bp_core_get_user_displayname( $user->user_id ) ?>"><?php echo bp_core_get_avatar( $user->user_id, 1 ) ?></a>
    186186            </div>
    187187        <?php endforeach; ?>
  • trunk/bp-friends.php

    r1517 r1518  
    336336                return apply_filters( 'bp_friends_multiple_friendship_accepted_notification', '<a href="' . $bp->loggedin_user->domain . $bp->friends->slug . '/my-friends/newest" title="' . __( 'My Friends', 'buddypress' ) . '">' . sprintf( __('%d friends accepted your friendship requests', 'buddypress' ), (int)$total_items ) . '</a>', (int)$total_items );     
    337337            } else {
    338                 $user_fullname = bp_core_global_user_fullname( $item_id );
     338                $user_fullname = bp_core_get_user_displayname( $item_id );
    339339                $user_url = bp_core_get_userurl( $item_id );
    340340                return apply_filters( 'bp_friends_single_friendship_accepted_notification', '<a href="' . $user_url . '?new" title="' . $user_fullname .'\'s profile">' . sprintf( __( '%s accepted your friendship request', 'buddypress' ), $user_fullname ) . '</a>', $user_fullname );
     
    346346                return apply_filters( 'bp_friends_multiple_friendship_request_notification', '<a href="' . $bp->loggedin_user->domain . $bp->friends->slug . '/requests" title="' . __( 'Friendship requests', 'buddypress' ) . '">' . sprintf( __('You have %d pending friendship requests', 'buddypress' ), (int)$total_items ) . '</a>', $total_items );     
    347347            } else {
    348                 $user_fullname = bp_core_global_user_fullname( $item_id );
     348                $user_fullname = bp_core_get_user_displayname( $item_id );
    349349                $user_url = bp_core_get_userurl( $item_id );
    350350                return apply_filters( 'bp_friends_single_friendship_request_notification', '<a href="' . $bp->loggedin_user->domain . $bp->friends->slug . '/requests" title="' . __( 'Friendship requests', 'buddypress' ) . '">' . sprintf( __('You have a friendship request from %s', 'buddypress' ), $user_fullname ) . '</a>', $user_fullname );
     
    472472    for ( $i = 0; $i < count($friend_ids); $i++ ) {
    473473        if ( function_exists('bp_user_fullname') )
    474             $display_name = bp_fetch_user_fullname($friend_ids[$i], false);
     474            $display_name = bp_core_get_user_displayname( $friend_ids[$i] );
    475475       
    476476        if ( $display_name != ' ' ) {
     
    510510            continue;
    511511           
    512         $display_name = bp_fetch_user_fullname($friend_ids['friends'][$i]->user_id, false);
     512        $display_name = bp_core_get_user_displayname( $friend_ids['friends'][$i]->user_id );
    513513       
    514514        if ( $display_name != ' ' ) {
  • trunk/bp-friends/bp-friends-notifications.php

    r1366 r1518  
    44    global $bp;
    55   
    6     $initiator_name = bp_fetch_user_fullname( $initiator_id, false );
     6    $initiator_name = bp_core_get_user_displayname( $initiator_id );
    77
    88    if ( 'no' == get_usermeta( (int)$friend_id, 'notification_friends_friendship_request' ) )
     
    4343    $friendship = new BP_Friends_Friendship( $friendship_id, false, false );
    4444   
    45     $friend_name = bp_fetch_user_fullname( $friend_id, false );
     45    $friend_name = bp_core_get_user_displayname( $friend_id );
    4646
    4747    if ( 'no' == get_usermeta( (int)$initiator_id, 'notification_friends_friendship_accepted' ) )
  • trunk/bp-groups.php

    r1515 r1518  
    299299    }
    300300}
    301 add_action( 'wp', 'groups_directory_groups_setup', 5 );
     301add_action( 'wp', 'groups_directory_groups_setup', 2 );
    302302
    303303/***** Screens **********/
     
    11051105                return apply_filters( 'bp_groups_multiple_new_membership_requests_notification', '<a href="' . $group_link . '/admin/membership-requests/" title="' . __( 'Group Membership Requests', 'buddypress' ) . '">' . sprintf( __('%d new membership requests for the group "%s"', 'buddypress' ), (int)$total_items, $group->name ) . '</a>', $group_link, $total_items, $group->name );     
    11061106            } else {
    1107                 $user_fullname = bp_core_global_user_fullname( $requesting_user_id );
     1107                $user_fullname = bp_core_get_user_displayname( $requesting_user_id );
    11081108                return apply_filters( 'bp_groups_single_new_membership_request_notification', '<a href="' . $group_link . '/admin/membership-requests/" title="' . $user_fullname .' requests group membership">' . sprintf( __('%s requests membership for the group "%s"', 'buddypress' ), $user_fullname, $group->name ) . '</a>', $group_link, $user_fullname, $group->name );
    11091109            }   
     
    22832283        $member_theme = 'bpmember';
    22842284
    2285     add_filter( 'theme_root', 'bp_core_set_member_theme_root' );
    2286     add_filter( 'theme_root_uri', 'bp_core_set_member_theme_root_uri' );
     2285    add_filter( 'theme_root', 'bp_core_filter_buddypress_theme_root' );
     2286    add_filter( 'theme_root_uri', 'bp_core_filter_buddypress_theme_root_uri' );
    22872287
    22882288    return $member_theme;
     
    23012301        $member_theme = 'bpmember';
    23022302   
    2303     add_filter( 'theme_root', 'bp_core_set_member_theme_root' );
    2304     add_filter( 'theme_root_uri', 'bp_core_set_member_theme_root_uri' );
     2303    add_filter( 'theme_root', 'bp_core_filter_buddypress_theme_root' );
     2304    add_filter( 'theme_root_uri', 'bp_core_filter_buddypress_theme_root_uri' );
    23052305   
    23062306    return $member_theme;
  • trunk/bp-groups/bp-groups-notifications.php

    r1408 r1518  
    1010    $group = new BP_Groups_Group( $group_id, false, true );
    1111   
    12     $poster_name = bp_fetch_user_fullname( $wire_post->user_id, false );
     12    $poster_name = bp_core_get_user_displayname( $wire_post->user_id );
    1313    $poster_ud = get_userdata( $wire_post->user_id );
    1414    $poster_profile_link = site_url() . '/' . BP_MEMBERS_SLUG . '/' . $poster_ud->user_login;
     
    9595        return false;
    9696       
    97     $requesting_user_name = bp_fetch_user_fullname( $requesting_user_id, false );
     97    $requesting_user_name = bp_core_get_user_displayname( $requesting_user_id );
    9898    $group = new BP_Groups_Group( $group_id, false, false );
    9999   
  • trunk/bp-groups/bp-groups-templatetags.php

    r1487 r1518  
    945945            <?php for ( $i = 0; $i < count($group_mods); $i++ ) { ?>
    946946                <li>
    947                     <a href="<?php echo bp_core_get_userlink( $group_mods[$i]->user_id, false, true ) ?>" title="<?php echo bp_fetch_user_fullname( $group_mods[$i]->user->user_id ) ?>"><?php echo bp_core_get_avatar( $group_mods[$i]->user_id, 1, 50, 50 ) ?></a>
     947                    <a href="<?php echo bp_core_get_userlink( $group_mods[$i]->user_id, false, true ) ?>" title="<?php echo bp_core_get_user_displayname( $group_mods[$i]->user->user_id ) ?>"><?php echo bp_core_get_avatar( $group_mods[$i]->user_id, 1, 50, 50 ) ?></a>
    948948                    <h5><?php echo bp_core_get_userlink( $group_mods[$i]->user_id ) ?></h5>
    949949                    <span class="activity"><?php _e( 'Group Mod', 'buddypress' ) ?></span>
     
    17721772        global $members_template;
    17731773
    1774         return apply_filters( 'bp_get_group_member_name', bp_fetch_user_fullname( $members_template->member->user_id, false ) );
     1774        return apply_filters( 'bp_get_group_member_name', bp_core_get_user_displayname( $members_template->member->user_id ) );
    17751775    }
    17761776
  • trunk/bp-messages/bp-messages-ajax.php

    r1497 r1518  
    3737            $ud = get_userdata($user_id);
    3838            $username = $ud->user_login;
    39             echo bp_core_get_avatar( $user_id, 1, 15, 15 ) . ' ' . bp_fetch_user_fullname( $user_id, false ) . ' (' . $username . ')
     39            echo bp_core_get_avatar( $user_id, 1, 15, 15 ) . ' ' . bp_core_get_user_displayname( $user_id ) . ' (' . $username . ')
    4040            ';
    4141        }       
  • trunk/bp-messages/bp-messages-notifications.php

    r1479 r1518  
    77    $message = new BP_Messages_Message( $item_id );
    88   
    9     $sender_name = bp_fetch_user_fullname( $message->sender_id, false );
     9    $sender_name = bp_core_get_user_displayname( $message->sender_id );
    1010
    1111    for ( $i = 0; $i < count($recipient_ids); $i++ ) {
  • trunk/bp-messages/bp-messages-templatetags.php

    r1503 r1518  
    451451   
    452452    if ( isset( $_GET['r'] ) ) {
    453         $user_id = bp_core_get_userid_from_user_login( $_GET['r'] );
     453        $user_id = bp_core_get_userid( $_GET['r'] );
    454454       
    455455        if ( $user_id ) {
  • trunk/bp-xprofile.php

    r1506 r1518  
    577577            return apply_filters( 'bp_xprofile_multiple_new_wire_post_notification', '<a href="' . $bp->loggedin_user->domain . $bp->wire->slug . '" title="' . __( 'Wire', 'buddypress' ) . '">' . sprintf( __( 'You have %d new posts on your wire', 'buddypress' ), (int)$total_items ) . '</a>', $total_items );       
    578578        } else {
    579             $user_fullname = bp_core_global_user_fullname( $item_id );
     579            $user_fullname = bp_core_get_user_displayname( $item_id );
    580580            return apply_filters( 'bp_xprofile_single_new_wire_post_notification', '<a href="' . $bp->loggedin_user->domain . $bp->wire->slug . '" title="' . __( 'Wire', 'buddypress' ) . '">' . sprintf( __( '%s posted on your wire', 'buddypress' ), $user_fullname ) . '</a>', $user_fullname );
    581581        }
  • trunk/bp-xprofile/bp-xprofile-notifications.php

    r1366 r1518  
    2626
    2727        if ( !get_usermeta( $bp->loggedin_user->id, 'notification_profile_wire_post' ) || 'yes' == get_usermeta( $bp->loggedin_user->id, 'notification_profile_wire_post' ) ) {
    28             $poster_name = bp_fetch_user_fullname( $poster_id, false );
     28            $poster_name = bp_core_get_user_displayname( $poster_id );
    2929            $wire_post = new BP_Wire_Post( $bp->profile->table_name_wire, $wire_post_id, true );
    3030            $ud = get_userdata($user_id);
Note: See TracChangeset for help on using the changeset viewer.