[ 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  function bp_settings_action_notifications() {
  16      if ( ! bp_is_post_request() ) {
  17          return;
  18      }
  19  
  20      // Bail if no submit action.
  21      if ( ! isset( $_POST['submit'] ) ) {
  22          return;
  23      }
  24  
  25      // Bail if not in settings.
  26      if ( ! bp_is_settings_component() || ! bp_is_current_action( 'notifications' ) ) {
  27          return false;
  28      }
  29  
  30      // 404 if there are any additional action variables attached
  31      if ( bp_action_variables() ) {
  32          bp_do_404();
  33          return;
  34      }
  35  
  36      check_admin_referer( 'bp_settings_notifications' );
  37  
  38      bp_settings_update_notification_settings( bp_displayed_user_id(), (array) $_POST['notifications'] );
  39  
  40      // Switch feedback for super admins.
  41      if ( bp_is_my_profile() ) {
  42          bp_core_add_message( __( 'Your notification settings have been saved.',        'buddypress' ), 'success' );
  43      } else {
  44          bp_core_add_message( __( "This user's notification settings have been saved.", 'buddypress' ), 'success' );
  45      }
  46  
  47      /**
  48       * Fires after the notification settings have been saved, and before redirect.
  49       *
  50       * @since 1.5.0
  51       */
  52      do_action( 'bp_core_notification_settings_after_save' );
  53  
  54      bp_core_redirect( bp_displayed_user_domain() . bp_get_settings_slug() . '/notifications/' );
  55  }
  56  add_action( 'bp_actions', 'bp_settings_action_notifications' );


Generated: Sun Jul 21 01:01:44 2019 Cross-referenced by PHPXref 0.7.1