[ 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( $args, array(
  25          'user_id'                => bp_displayed_user_id(),
  26          'profile_group_id'       => false,
  27          'hide_empty_groups'      => false,
  28          'hide_empty_fields'      => false,
  29          'fetch_fields'           => true,
  30          'fetch_field_data'       => false,
  31          'fetch_visibility_level' => true,
  32          'exclude_groups'         => false,
  33          'exclude_fields'         => false
  34      ), 'xprofile_get_settings_fields' );
  35  
  36      return bp_has_profile( $r );
  37  }
  38  
  39  /**
  40   * Adds feedback messages when successfully saving profile field settings.
  41   *
  42   * @since 2.0.0
  43   *
  44   */
  45  function bp_xprofile_settings_add_feedback_message() {
  46  
  47      // Default message type is success.
  48      $type    = 'success';
  49      $message = __( 'Your profile settings have been saved.',        'buddypress' );
  50  
  51      // Community moderator editing another user's settings.
  52      if ( ! bp_is_my_profile() && bp_core_can_edit_settings() ) {
  53          $message = __( "This member's profile settings have been saved.", 'buddypress' );
  54      }
  55  
  56      // Add the message.
  57      bp_core_add_message( $message, $type );
  58  }
  59  add_action( 'bp_xprofile_settings_after_save', 'bp_xprofile_settings_add_feedback_message' );


Generated: Wed Nov 13 01:01:39 2019 Cross-referenced by PHPXref 0.7.1