[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-settings/actions/ -> notifications.php (source)

   1  <?php
   2  /**
   3   * Settings: Email notifications action handler.
   4   *
   5   * @package BuddyPress
   6   * @subpackage SettingsActions
   7   * @since 3.0.0
   8   */
   9  
  10  /**
  11   * Handles the changing and saving of user notification settings.
  12   *
  13   * @since 1.6.0
  14   *
  15   * @return bool|void
  16   */
  17  function bp_settings_action_notifications() {
  18      if ( ! bp_is_post_request() ) {
  19          return;
  20      }
  21  
  22      // Bail if no submit action.
  23      if ( ! isset( $_POST['submit'] ) ) {
  24          return;
  25      }
  26  
  27      // Bail if not in settings.
  28      if ( ! bp_is_settings_component() || ! bp_is_current_action( 'notifications' ) ) {
  29          return false;
  30      }
  31  
  32      // 404 if there are any additional action variables attached
  33      if ( bp_action_variables() ) {
  34          bp_do_404();
  35          return;
  36      }
  37  
  38      check_admin_referer( 'bp_settings_notifications' );
  39  
  40      bp_settings_update_notification_settings( bp_displayed_user_id(), (array) $_POST['notifications'] );
  41  
  42      // Switch feedback for super admins.
  43      if ( bp_is_my_profile() ) {
  44          bp_core_add_message( __( 'Your notification settings have been saved.',        'buddypress' ), 'success' );
  45      } else {
  46          bp_core_add_message( __( "This user's notification settings have been saved.", 'buddypress' ), 'success' );
  47      }
  48  
  49      /**
  50       * Fires after the notification settings have been saved, and before redirect.
  51       *
  52       * @since 1.5.0
  53       */
  54      do_action( 'bp_core_notification_settings_after_save' );
  55  
  56      bp_core_redirect( bp_displayed_user_domain() . bp_get_settings_slug() . '/notifications/' );
  57  }
  58  add_action( 'bp_actions', 'bp_settings_action_notifications' );


Generated: Thu Apr 25 01:01:12 2024 Cross-referenced by PHPXref 0.7.1