Changeset 527
- Timestamp:
- 11/10/2008 11:22:03 AM (18 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
-
bp-core.php (modified) (2 diffs)
-
bp-friends.php (modified) (2 diffs)
-
bp-groups.php (modified) (13 diffs)
-
bp-messages.php (modified) (7 diffs)
-
bp-wire.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 /** -
trunk/bp-friends.php
r525 r527 132 132 bp_core_add_message( __('Friendship could not be accepted', 'buddypress'), 'error' ); 133 133 } 134 wp_redirect( $_SERVER['HTTP_REFERER'] );134 bp_core_redirect( $_SERVER['HTTP_REFERER'] ); 135 135 136 136 } else if ( isset($bp['action_variables']) && in_array( 'reject', $bp['action_variables'] ) && is_numeric($bp['action_variables'][1]) ) { … … 141 141 bp_core_add_message( __('Friendship could not be rejected', 'buddypress'), 'error' ); 142 142 } 143 wp_redirect( $_SERVER['HTTP_REFERER'] );143 bp_core_redirect( $_SERVER['HTTP_REFERER'] ); 144 144 } 145 145 -
trunk/bp-groups.php
r524 r527 288 288 bp_core_add_message( __('Group invite could not be accepted', 'buddypress'), 'error' ); 289 289 } 290 wp_redirect( $_SERVER['HTTP_REFERER'] );290 bp_core_redirect( $_SERVER['HTTP_REFERER'] ); 291 291 292 292 } else if ( isset($bp['action_variables']) && in_array( 'reject', $bp['action_variables'] ) && is_numeric($bp['action_variables'][1]) ) { … … 296 296 bp_core_add_message( __('Group invite could not be rejected', 'buddypress'), 'error' ); 297 297 } 298 wp_redirect( $_SERVER['HTTP_REFERER'] );298 bp_core_redirect( $_SERVER['HTTP_REFERER'] ); 299 299 } 300 300 … … 336 336 // We're done. 337 337 if ( $create_group_step == 4 ) 338 wp_redirect( bp_group_permalink( $group_obj, false ) );338 bp_core_redirect( bp_group_permalink( $group_obj, false ) ); 339 339 340 340 if ( !$group_id = groups_manage_group( $create_group_step, $_SESSION['group_obj_id'] ) ) { 341 341 bp_core_add_message( __('There was an error saving group details. Please try again.', 'buddypress'), 'error' ); 342 wp_redirect( $bp['loggedin_domain'] . $bp['groups']['slug'] . '/create/step/' . $create_group_step );342 bp_core_redirect( $bp['loggedin_domain'] . $bp['groups']['slug'] . '/create/step/' . $create_group_step ); 343 343 } else { 344 344 $create_group_step++; … … 396 396 397 397 if ( !strpos( $_SERVER['HTTP_REFERER'], $bp['wire']['slug'] ) ) { 398 wp_redirect( bp_group_permalink( $group_obj, false ) );398 bp_core_redirect( bp_group_permalink( $group_obj, false ) ); 399 399 } else { 400 wp_redirect( bp_group_permalink( $group_obj, false ) . '/' . $bp['wire']['slug'] );400 bp_core_redirect( bp_group_permalink( $group_obj, false ) . '/' . $bp['wire']['slug'] ); 401 401 } 402 402 … … 411 411 412 412 if ( !strpos( $_SERVER['HTTP_REFERER'], $bp['wire']['slug'] ) ) { 413 wp_redirect( bp_group_permalink( $group_obj, false ) );413 bp_core_redirect( bp_group_permalink( $group_obj, false ) ); 414 414 } else { 415 wp_redirect( bp_group_permalink( $group_obj, false ) . '/' . $bp['wire']['slug'] );415 bp_core_redirect( bp_group_permalink( $group_obj, false ) . '/' . $bp['wire']['slug'] ); 416 416 } 417 417 … … 453 453 454 454 bp_core_add_message( __('Group invites sent.', 'buddypress') ); 455 wp_redirect( bp_group_permalink( $group_obj, false ) );455 bp_core_redirect( bp_group_permalink( $group_obj, false ) ); 456 456 } else { 457 457 // Show send invite page … … 470 470 if ( !groups_leave_group( $group_obj->id ) ) { 471 471 bp_core_add_message( __('There was an error leaving the group. Please try again.', 'buddypress'), 'error' ); 472 wp_redirect( bp_group_permalink( $group_obj, false) );472 bp_core_redirect( bp_group_permalink( $group_obj, false) ); 473 473 } else { 474 474 bp_core_add_message( __('You left the group successfully.', 'buddypress') ); 475 wp_redirect( $bp['loggedin_domain'] . $bp['groups']['slug'] );475 bp_core_redirect( $bp['loggedin_domain'] . $bp['groups']['slug'] ); 476 476 } 477 477 } else if ( isset($bp['action_variables']) && $bp['action_variables'][0] == 'no' ) { 478 wp_redirect( bp_group_permalink( $group_obj, false) );478 bp_core_redirect( bp_group_permalink( $group_obj, false) ); 479 479 } else { 480 480 // Show leave group page … … 498 498 bp_core_add_message( __( 'Your membership request was sent to the group administrator successfully. You will be notified when the group administrator responds to your request.', 'buddypress' ) ); 499 499 } 500 wp_redirect( bp_group_permalink( $group_obj, false ) );500 bp_core_redirect( bp_group_permalink( $group_obj, false ) ); 501 501 } 502 502 bp_catch_uri( 'groups/request-membership' ); … … 526 526 bp_core_add_message( __( 'Group details were successfully updated.', 'buddypress' ) ); 527 527 } 528 wp_redirect( $_SERVER['HTTP_REFERER'] );528 bp_core_redirect( $_SERVER['HTTP_REFERER'] ); 529 529 } 530 530 … … 557 557 } 558 558 559 wp_redirect( $_SERVER['HTTP_REFERER'] );559 bp_core_redirect( $_SERVER['HTTP_REFERER'] ); 560 560 } 561 561 … … 596 596 } 597 597 } 598 wp_redirect( $_SERVER['HTTP_REFERER'] );598 bp_core_redirect( $_SERVER['HTTP_REFERER'] ); 599 599 } 600 600 … … 618 618 } else { 619 619 bp_core_add_message( __( 'The group was deleted successfully', 'buddypress' ) ); 620 wp_redirect( site_url() . '/' . $bp['groups']['slug'] . '/' );620 bp_core_redirect( site_url() . '/' . $bp['groups']['slug'] . '/' ); 621 621 } 622 wp_redirect( $_SERVER['HTTP_REFERER'] );622 bp_core_redirect( $_SERVER['HTTP_REFERER'] ); 623 623 } else { 624 624 bp_catch_uri( 'groups/admin/delete-group' ); … … 691 691 bp_core_add_message( __('You joined the group!', 'buddypress') ); 692 692 } 693 wp_redirect( $_SERVER['HTTP_REFERER'] );693 bp_core_redirect( $_SERVER['HTTP_REFERER'] ); 694 694 } 695 695 -
trunk/bp-messages.php
r518 r527 281 281 282 282 if ( !$thread_id || !is_numeric($thread_id) || !BP_Messages_Thread::check_access($thread_id) ) { 283 wp_redirect( $_SERVER['HTTP_REFERER'] );283 bp_core_redirect( $_SERVER['HTTP_REFERER'] ); 284 284 } else { 285 285 // delete message 286 286 if ( !BP_Messages_Thread::delete($thread_id) ) { 287 287 bp_core_add_message( __('There was an error deleting that message.', 'buddypress'), 'error' ); 288 wp_redirect( $_SERVER['HTTP_REFERER'] );288 bp_core_redirect( $_SERVER['HTTP_REFERER'] ); 289 289 } else { 290 290 bp_core_add_message( __('Message deleted.', 'buddypress') ); 291 wp_redirect( $_SERVER['HTTP_REFERER'] );291 bp_core_redirect( $_SERVER['HTTP_REFERER'] ); 292 292 } 293 293 } … … 310 310 if ( !BP_Messages_Thread::delete( explode(',', $thread_ids ) ) ) { 311 311 bp_core_add_message( __('There was an error deleting messages.', 'buddypress'), 'error' ); 312 wp_redirect( $_SERVER['HTTP_REFERER'] );312 bp_core_redirect( $_SERVER['HTTP_REFERER'] ); 313 313 } else { 314 314 bp_core_add_message( __('Messages deleted.', 'buddypress') ); 315 wp_redirect( $_SERVER['HTTP_REFERER'] );315 bp_core_redirect( $_SERVER['HTTP_REFERER'] ); 316 316 } 317 317 } … … 367 367 if ( !$from_ajax ) { 368 368 bp_core_add_message( __('Please enter at least one valid user to send this message to.', 'buddypress'), 'error' ); 369 wp_redirect( $_SERVER['HTTP_REFERER'] );369 bp_core_redirect( $_SERVER['HTTP_REFERER'] ); 370 370 } else { 371 371 return array('status' => 0, 'message' => __('There was an error sending the reply, please try again.', 'buddypress')); … … 374 374 if ( !$from_ajax ) { 375 375 bp_core_add_message( __('Please make sure you fill in all the fields.', 'buddypress'), 'error' ); 376 wp_redirect( $_SERVER['HTTP_REFERER'] );376 bp_core_redirect( $_SERVER['HTTP_REFERER'] ); 377 377 } else { 378 378 return array('status' => 0, 'message' => __('Please make sure you have typed a message before sending a reply.', 'buddypress')); … … 405 405 } else { 406 406 bp_core_add_message( $message, $type ); 407 wp_redirect( $_SERVER['HTTP_REFERER'] );407 bp_core_redirect( $_SERVER['HTTP_REFERER'] ); 408 408 } 409 409 } else { … … 424 424 } else { 425 425 bp_core_add_message( $message ); 426 wp_redirect( $bp['loggedin_domain'] . $bp['messages']['slug'] . '/inbox' );426 bp_core_redirect( $bp['loggedin_domain'] . $bp['messages']['slug'] . '/inbox' ); 427 427 } 428 428 } … … 435 435 } else { 436 436 bp_core_add_message( $message, $type ); 437 wp_redirect( $bp['loggedin_domain'] . $bp['messages']['slug'] . '/compose' );437 bp_core_redirect( $bp['loggedin_domain'] . $bp['messages']['slug'] . '/compose' ); 438 438 } 439 439 } -
trunk/bp-wire.php
r518 r527 96 96 97 97 if ( !strpos( $_SERVER['HTTP_REFERER'], $bp['wire']['slug'] ) ) { 98 wp_redirect( $bp['current_domain'] );98 bp_core_redirect( $bp['current_domain'] ); 99 99 } else { 100 wp_redirect( $bp['current_domain']. $bp['wire']['slug'] );100 bp_core_redirect( $bp['current_domain']. $bp['wire']['slug'] ); 101 101 } 102 102 } … … 118 118 119 119 if ( !strpos( $_SERVER['HTTP_REFERER'], $bp['wire']['slug'] ) ) { 120 wp_redirect( $bp['current_domain'] );120 bp_core_redirect( $bp['current_domain'] ); 121 121 } else { 122 wp_redirect( $bp['current_domain']. $bp['wire']['slug'] );122 bp_core_redirect( $bp['current_domain']. $bp['wire']['slug'] ); 123 123 } 124 124 }
Note: See TracChangeset
for help on using the changeset viewer.