mute_action_start

Start muting a user if JavaScript is disabled.

Description

mute_action_start(); 

Usage

  1. if ( !function_exists( 'mute_action_start' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress-mute/inc/functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = mute_action_start(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/inc/functions.php  
  1. function mute_action_start() { 
  2.  
  3. if ( ! bp_is_current_component( mute ) || ! bp_is_current_action( 'start' ) ) { 
  4. return; 
  5.  
  6. // Check the nonce. 
  7. check_admin_referer( mute ); 
  8.  
  9. $obj = new Mute( bp_displayed_user_id(), bp_loggedin_user_id() ); 
  10.  
  11. if ( $obj->id ) { 
  12. $message = sprintf( __( 'You are already muting %s.', 'buddypress-mute' ), bp_get_displayed_user_fullname() ); 
  13. $status = error; 
  14. } else { 
  15. if ( $obj->save() === false ) { 
  16. $message = __( 'This user could not be muted. Try again.', 'buddypress-mute' ); 
  17. $status = error; 
  18. } else { 
  19. $message = sprintf( __( 'You are now muting %s.', 'buddypress-mute' ), bp_get_displayed_user_fullname() ); 
  20. $status = 'success'; 
  21.  
  22. // Output the message. 
  23. bp_core_add_message( $message, $status ); 
  24. bp_core_redirect( wp_get_referer() );