[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-groups/actions/ -> random.php (source)

   1  <?php
   2  /**
   3   * Groups: Random group action handler
   4   *
   5   * @package BuddyPress
   6   * @subpackage GroupActions
   7   * @since 3.0.0
   8   */
   9  
  10  /**
  11   * Catch requests for a random group page (example.com/groups/?random-group) and redirect.
  12   *
  13   * @since 1.2.0
  14   */
  15  function groups_action_redirect_to_random_group() {
  16  
  17      if ( bp_is_groups_component() && isset( $_GET['random-group'] ) ) {
  18          $group = BP_Groups_Group::get_random( 1, 1 );
  19  
  20          bp_core_redirect( trailingslashit( bp_get_groups_directory_permalink() . $group['groups'][0]->slug ) );
  21      }
  22  }
  23  add_action( 'bp_actions', 'groups_action_redirect_to_random_group' );


Generated: Tue Nov 5 01:00:58 2024 Cross-referenced by PHPXref 0.7.1