[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-xprofile/ -> bp-xprofile-settings.php (source)

   1  <?php
   2  /**
   3   * BuddyPress XProfile Settings.
   4   *
   5   * @package    BuddyPress
   6   * @subpackage XProfileSettings
   7   * @since 2.0.0
   8   */
   9  
  10  // Exit if accessed directly.
  11  defined( 'ABSPATH' ) || exit;
  12  
  13  /**
  14   * Query all profile fields and their visibility data for display in settings.
  15   *
  16   * @since 2.0.0
  17   *
  18   * @param array|string $args Array of args for the settings fields.
  19   * @return bool
  20   */
  21  function bp_xprofile_get_settings_fields( $args = '' ) {
  22  
  23      // Parse the possible arguments.
  24      $r = bp_parse_args(
  25          $args,
  26          array(
  27              'user_id'                => bp_displayed_user_id(),
  28              'profile_group_id'       => false,
  29              'hide_empty_groups'      => false,
  30              'hide_empty_fields'      => false,
  31              'fetch_fields'           => true,
  32              'fetch_field_data'       => false,
  33              'fetch_visibility_level' => true,
  34              'exclude_groups'         => false,
  35              'exclude_fields'         => false,
  36          ),
  37          'xprofile_get_settings_fields'
  38      );
  39  
  40      return bp_has_profile( $r );
  41  }
  42  
  43  /**
  44   * Adds feedback messages when successfully saving profile field settings.
  45   *
  46   * @since 2.0.0
  47   */
  48  function bp_xprofile_settings_add_feedback_message() {
  49  
  50      // Default message type is success.
  51      $type    = 'success';
  52      $message = __( 'Your profile settings have been saved.',        'buddypress' );
  53  
  54      // Community moderator editing another user's settings.
  55      if ( ! bp_is_my_profile() && bp_core_can_edit_settings() ) {
  56          $message = __( "This member's profile settings have been saved.", 'buddypress' );
  57      }
  58  
  59      // Add the message.
  60      bp_core_add_message( $message, $type );
  61  }
  62  add_action( 'bp_xprofile_settings_after_save', 'bp_xprofile_settings_add_feedback_message' );


Generated: Thu Nov 21 01:00:57 2024 Cross-referenced by PHPXref 0.7.1