[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-messages/actions/ -> exit.php (source)

   1  <?php
   2  /**
   3   * Messages: Exit action handler.
   4   *
   5   * @package BuddyPress
   6   * @subpackage MessageActions
   7   * @since 10.0.0
   8   */
   9  
  10  /**
  11   * Process a request to exit a messages thread.
  12   *
  13   * @since 10.0.0
  14   */
  15  function bp_messages_action_exit_thread() {
  16  
  17      if ( ! bp_is_messages_component() || bp_is_current_action( 'notices' ) || ! bp_is_action_variable( 'exit', 0 ) ) {
  18          return false;
  19      }
  20  
  21      $thread_id = bp_action_variable( 1 );
  22  
  23      if ( ! $thread_id || ! is_numeric( $thread_id ) || ! messages_check_thread_access( $thread_id ) ) {
  24          bp_core_redirect( trailingslashit( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() ) );
  25      } else {
  26          if ( ! check_admin_referer( 'bp_messages_exit_thread' ) ) {
  27              return false;
  28          }
  29  
  30          // Exit message.
  31          if ( ! bp_messages_exit_thread( $thread_id ) ) {
  32              bp_core_add_message( __('There was an error exiting the conversation.', 'buddypress'), 'error' );
  33          } else {
  34              bp_core_add_message( __('You have left the message thread.', 'buddypress') );
  35          }
  36  
  37          bp_core_redirect( trailingslashit( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() ) );
  38      }
  39  }
  40  add_action( 'bp_actions', 'bp_messages_action_exit_thread' );


Generated: Sat Apr 27 01:00:55 2024 Cross-referenced by PHPXref 0.7.1