buddypress/bp-xprofile/bp-xprofile-settings.php
John James Jacoby e68b3b63f3 First pass at Profile Settings for improved profile field visibility UX:
* Adds `/members/single/settings/profile.php` template to `bp-legacy` and `bp-default`.
* Introduces `bp-xprofile.settings.php` for Settings specific functionality going forward.
* Introduces actions & screens for handling output and saving of profile visibility data.
* Introduces `_is_` function for identifying the new component/action URL.
* See #5352. (still more @todo...)

git-svn-id: https://buddypress.svn.wordpress.org/trunk@7960 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
2014-02-21 23:08:04 +00:00

53 lines
1.4 KiB
PHP

<?php
/**
* Query all profile fields and their visibility data for display in settings
*
* @since BuddyPress (2.0.0)
*
* @param array $args
*
*
* @return array
*/
function bp_xprofile_get_settings_fields( $args = '' ) {
// Parse the possible arguments
$r = bp_parse_args( $args, array(
'user_id' => bp_displayed_user_id(),
'profile_group_id' => false,
'hide_empty_groups' => false,
'hide_empty_fields' => false,
'fetch_fields' => true,
'fetch_field_data' => false,
'fetch_visibility_level' => true,
'exclude_groups' => false,
'exclude_fields' => false
), 'xprofile_get_settings_fields' );
return bp_has_profile( $r );
}
/**
* Adds feedback messages when successfully saving profile field settings
*
* @since BuddyPress (2.0.0)
*
* @uses bp_core_add_message()
* @usse bp_is_my_profile()
*/
function bp_xprofile_settings_add_feedback_message() {
// Default message type is success
$type = 'success';
$message = __( 'Your profile settings have been saved.', 'buddypress' );
// Community moderator editing another user's settings
if ( ! bp_is_my_profile() && bp_core_can_edit_settings() ) {
$message = __( "This member's profile settings have been saved.", 'buddypress' );
}
// Add the message
bp_core_add_message( $message, $type );
}
add_action( 'bp_xprofile_settings_after_save', 'bp_xprofile_settings_add_feedback_message' );