Changeset 5686 for trunk/bp-blogs/bp-blogs-actions.php
- Timestamp:
- 02/09/2012 10:36:36 PM (14 years ago)
- File:
-
- 1 edited
-
trunk/bp-blogs/bp-blogs-actions.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-blogs/bp-blogs-actions.php
r4961 r5686 1 1 <?php 2 3 /** 4 * BuddyPress Blogs Actions 5 * 6 * @package BuddyPress 7 * @subpackage BlogsActions 8 */ 9 2 10 // Exit if accessed directly 3 11 if ( !defined( 'ABSPATH' ) ) exit; 4 12 13 /** 14 * Redirect to a random blog in the multisite network 15 * 16 * @since BuddyPress (1.0) 17 * @package BuddyPress 18 * @subpackage BlogsActions 19 */ 5 20 function bp_blogs_redirect_to_random_blog() { 6 global $bp, $wpdb;7 21 8 if ( bp_is_blogs_component() && isset( $_GET['random-blog'] ) ) { 22 // Bail if not looking for a random blog 23 if ( ! bp_is_blogs_component() || ! isset( $_GET['random-blog'] ) ) 24 return; 25 26 // Multisite is active so find a random blog 27 if ( is_multisite() ) { 9 28 $blog = bp_blogs_get_random_blogs( 1, 1 ); 29 bp_core_redirect( get_site_url( $blog['blogs'][0]->blog_id ) ); 10 30 11 bp_core_redirect( get_site_url( $blog['blogs'][0]->blog_id ) ); 31 // No multisite and still called, always redirect to root 32 } else { 33 bp_core_redirect( bp_core_get_root_domain() ); 12 34 } 13 35 }
Note: See TracChangeset
for help on using the changeset viewer.