Changeset 392
- Timestamp:
- 10/12/2008 11:58:11 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
-
bp-core.php (modified) (3 diffs)
-
bp-core/bp-core-catchuri.php (modified) (4 diffs)
-
bp-core/bp-core-cssjs.php (modified) (1 diff)
-
bp-core/bp-core-templatetags.php (modified) (1 diff)
-
bp-groups.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core.php
r391 r392 42 42 global $current_user, $current_component, $current_action; 43 43 global $action_variables; 44 44 45 45 /* The user ID of the user who is currently logged in. */ 46 46 $bp['loggedin_userid'] = $current_user->ID; … … 1034 1034 global $bp; 1035 1035 1036 if ( !is_user_logged_in() )1036 if ( !is_user_logged_in() || !get_usermeta( $bp['loggedin_userid'], 'last_activity') ) 1037 1037 return false; 1038 1038 … … 1111 1111 add_action( 'get_comment_author_link', 'bp_core_replace_comment_author_link', 10, 4 ); 1112 1112 1113 /** 1114 * bp_core_get_site_path() 1115 * 1116 * Get the path of of the current site. 1117 * 1118 * @package BuddyPress Core 1119 * @global $comment WordPress comment global for the current comment. 1120 * @uses bp_core_get_userlink_by_email() Fetches a userlink via email address. 1121 */ 1122 function bp_core_get_site_path() { 1123 global $wpdb; 1124 1125 return $wpdb->get_var( $wpdb->prepare( "SELECT path FROM {$wpdb->base_prefix}site WHERE id = 1") ); 1126 } 1113 1127 1114 1128 /** -
trunk/bp-core/bp-core-catchuri.php
r388 r392 17 17 * - VHOST: http:// andy.domain.com / [current_component] / [current_action] / [action_variables] / [action_variables] / ... 18 18 * - NO VHOST: http:// domain.com / andy / [current_component] / [current_action] / [action_variables] / [action_variables] / ... 19 * - OUTSIDE ROOT: http:// domain.com / sites / buddypress / andy / [current_component] / [current_action] / [action_variables] / [action_variables] / ... 19 20 * 20 * Example:21 * Example: 21 22 * - http://andy.domain.com/profile/edit/group/5/ 22 23 * - $current_component: string 'profile' … … 28 29 function bp_core_set_uri_globals() { 29 30 global $current_component, $current_action, $action_variables; 30 31 31 32 /* Fetch the current URI and explode each part seperated by '/' into an array */ 32 33 $bp_uri = explode( "/", $_SERVER['REQUEST_URI'] ); 33 34 /* This is used to determine where the component and action indexes should start */35 $root_components = explode( ',', BP_CORE_ROOT_COMPONENTS );36 $is_root_component = in_array( $bp_uri[1], $root_components );37 34 38 35 /* Set the indexes, these are incresed by one if we are not on a VHOST install */ 39 36 $component_index = 0; 40 $action_index = 1; 37 $action_index = $component_index + 1; 38 39 /* Get site path items */ 40 $paths = explode( '/', bp_core_get_site_path() ); 41 41 42 if ( VHOST == 'no' && !$is_root_component ) { 43 $component_index++; 44 $action_index++; 45 } 42 /* Take empties off the end */ 43 if ( $paths[count($paths) - 1] == "" ) 44 array_pop( $paths ); 46 45 46 /* Take empties off the start */ 47 if ( $paths[0] == "" ) 48 array_shift( $paths ); 49 47 50 /* Take empties off the end */ 48 51 if ( $bp_uri[count($bp_uri) - 1] == "" ) … … 52 55 if ( $bp_uri[0] == "" ) 53 56 array_shift( $bp_uri ); 54 57 55 58 /* Get total URI segment count */ 56 59 $bp_uri_count = count( $bp_uri ) - 1; 60 61 for ( $i = 0; $i < $bp_uri_count; $i++ ) { 62 if ( in_array( $bp_uri[$i], $paths )) { 63 unset( $bp_uri[$i] ); 64 } 65 } 57 66 67 /* Reset the keys by merging with an empty array */ 68 $bp_uri = array_merge( array(), $bp_uri ); 69 70 /* This is used to determine where the component and action indexes should start */ 71 $root_components = explode( ',', BP_CORE_ROOT_COMPONENTS ); 72 $is_root_component = in_array( $bp_uri[0], $root_components ); 73 74 if ( VHOST == 'no' && !$is_root_component ) { 75 $component_index++; 76 $action_index++; 77 } 78 58 79 /* Set the current component */ 59 80 $current_component = $bp_uri[$component_index]; … … 65 86 $action_variables = $bp_uri; 66 87 67 /* Remove the username from action variables if this is not a VHOST install */68 if ( VHOST == 'no' )69 unset($action_variables[0]);70 71 88 /* Unset the current_component and action from action_variables */ 72 89 unset($action_variables[$component_index]); 73 90 unset($action_variables[$action_index]); 91 92 /* Remove the username from action variables if this is not a VHOST install */ 93 if ( VHOST == 'no' && !$is_root_component ) 94 array_shift($action_variables); 74 95 75 96 /* Reset the keys by merging with an empty array */ -
trunk/bp-core/bp-core-cssjs.php
r375 r392 38 38 */ 39 39 function bp_core_add_css() { 40 if ( is_user_logged_in() ) {40 if ( is_user_logged_in() && bp_core_user_has_home() ) { 41 41 wp_enqueue_style( 'bp-admin-bar', site_url() . '/wp-content/mu-plugins/bp-core/css/admin-bar.css' ); 42 42 wp_print_styles(); -
trunk/bp-core/bp-core-templatetags.php
r391 r392 302 302 303 303 function bp_loggedinuser_link() { 304 global $bp; 305 echo bp_core_get_userlink( $bp['loggedin_userid'] ); 304 global $bp, $current_user; 305 306 if ( $link = bp_core_get_userlink( $bp['loggedin_userid'] ) ) { 307 echo $link; 308 } else { 309 $ud = get_userdata($current_user->ID); 310 echo $ud->user_login; 311 } 306 312 } 307 313 -
trunk/bp-groups.php
r391 r392 237 237 bp_core_set_uri_globals(); 238 238 $groups_bp = groups_setup_globals(true); 239 239 240 240 if ( $current_component == $groups_bp['groups']['slug'] ) 241 241 $is_single_group = BP_Groups_Group::group_exists( $current_action, $groups_bp['groups']['table_name'] ); … … 342 342 if ( isset($_COOKIE['group_obj_id']) && !$group_obj && !$no_instantiate ) 343 343 $group_obj = new BP_Groups_Group( (int)$_COOKIE['group_obj_id'] ); 344 344 345 345 bp_catch_uri( 'groups/create' ); 346 346 }
Note: See TracChangeset
for help on using the changeset viewer.