Changeset 527 for trunk/bp-core.php
- Timestamp:
- 11/10/2008 11:22:03 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/bp-core.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core.php
r519 r527 213 213 add_action( 'admin_menu', 'bp_core_check_installed' ); 214 214 215 215 /** 216 * bp_core_add_admin_menu() 217 * 218 * Adds the "BuddyPress" admin submenu item to the Site Admin tab. 219 * 220 * @package BuddyPress Core 221 * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals() 222 * @global $wpdb WordPress DB access object. 223 * @uses is_site_admin() returns true if the current user is a site admin, false if not 224 * @uses add_submenu_page() WP function to add a submenu item 225 */ 216 226 function bp_core_add_admin_menu() { 217 227 global $wpdb, $bp; … … 224 234 add_action( 'admin_menu', 'bp_core_add_admin_menu' ); 225 235 236 /** 237 * bp_core_redirect() 238 * 239 * Perform a safe wp_redirect without causing redirect loops due to confirmation redirects. 240 * 241 * @package BuddyPress Core 242 * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals() 243 * @global $wpdb WordPress DB access object. 244 * @uses bp_core_is_root_component() checks if a component sits in the root of the site 245 * @uses site_url() Returns the site url including protocol 246 */ 247 function bp_core_redirect( $url ) { 248 global $bp; 249 250 if ( isset( $_GET['nr'] ) ) { 251 if ( bp_core_is_root_component( $bp['current_component'] ) ) { 252 if ( $bp['current_item'] != '' ) 253 $url = site_url() . '/' . $bp[$bp['current_component']]['slug'] . '/' . $bp['current_item'] . '/' . $bp['current_action'] . '/' . $bp['action_variables'][0]; 254 else 255 $url = site_url() . '/' . $bp[$bp['current_component']]['slug'] . '/' . $bp['current_action'] . '/' . $bp['action_variables'][0]; 256 } else { 257 $url = $bp['loggedin_domain'] . $bp[$bp['current_component']]['slug'] . '/' . $bp['current_action']; 258 } 259 } 260 261 wp_redirect( $url ); 262 } 263 264 /** 265 * bp_core_is_root_component() 266 * 267 * Checks to see if a component's URL should be in the root, not under a member page: 268 * eg: http://domain.com/groups/the-group NOT http://domain.com/members/andy/groups/the-group 269 * 270 * @package BuddyPress Core 271 * @return true if root component, else false. 272 */ 273 function bp_core_is_root_component( $component_name ) { 274 $root_components = explode( ',', BP_CORE_ROOT_COMPONENTS ); 275 return in_array( $component_name, $root_components ); 276 } 226 277 227 278 /**
Note: See TracChangeset
for help on using the changeset viewer.