diff --git src/bp-templates/bp-legacy/buddypress/members/single/profile/edit.php src/bp-templates/bp-legacy/buddypress/members/single/profile/edit.php
index 029f669..7fe800f 100644
|
|
if ( bp_has_profile( 'profile_group_id=' . bp_get_current_profile_group_id() ) ) |
63 | 63 | <input type="submit" name="profile-group-edit-submit" id="profile-group-edit-submit" value="<?php esc_attr_e( 'Save Changes', 'buddypress' ); ?> " /> |
64 | 64 | </div> |
65 | 65 | |
66 | | <input type="hidden" name="field_ids" id="field_ids" value="<?php bp_the_profile_group_field_ids(); ?>" /> |
| 66 | <input type="hidden" name="field_ids" id="field_ids" value="<?php bp_the_profile_field_ids(); ?>" /> |
67 | 67 | |
68 | 68 | <?php wp_nonce_field( 'bp_xprofile_edit' ); ?> |
69 | 69 | |
diff --git src/bp-templates/bp-legacy/buddypress/members/single/settings/profile.php src/bp-templates/bp-legacy/buddypress/members/single/settings/profile.php
index 4e5f1b2..0fdae6f 100644
|
|
|
46 | 46 | |
47 | 47 | <?php wp_nonce_field( 'bp_xprofile_settings' ); ?> |
48 | 48 | |
49 | | <input type="hidden" name="field_ids" id="field_ids" value="<?php bp_the_profile_group_field_ids(); ?>" /> |
| 49 | <input type="hidden" name="field_ids" id="field_ids" value="<?php bp_the_profile_field_ids(); ?>" /> |
50 | 50 | |
51 | 51 | </form> |
52 | 52 | |
diff --git src/bp-xprofile/bp-xprofile-actions.php src/bp-xprofile/bp-xprofile-actions.php
index b361ca9..d45211e 100644
|
|
function bp_xprofile_action_settings() { |
85 | 85 | // Get the POST'ed field ID's |
86 | 86 | $posted_field_ids = explode( ',', $_POST['field_ids'] ); |
87 | 87 | |
| 88 | // Backward compatibility: a bug in BP 2.0 caused only a single |
| 89 | // group's field IDs to be submitted. Look for values submitted |
| 90 | // in the POST request that may not appear in 'field_ids', and |
| 91 | // add them to the list of IDs to save. |
| 92 | foreach ( $_POST as $posted_key => $posted_value ) { |
| 93 | preg_match( '/^field_([0-9]+)_visibility$/', $posted_key, $matches ); |
| 94 | if ( ! empty( $matches[1] ) && ! in_array( $matches[1], $posted_field_ids ) ) { |
| 95 | $posted_field_ids[] = $matches[1]; |
| 96 | } |
| 97 | } |
| 98 | |
88 | 99 | // Save the visibility settings |
89 | 100 | foreach ( $posted_field_ids as $field_id ) { |
90 | 101 | |
diff --git src/bp-xprofile/bp-xprofile-template.php src/bp-xprofile/bp-xprofile-template.php
index a95f90d..e62e739 100644
|
|
function bp_the_profile_group_field_ids() { |
314 | 314 | return substr( $field_ids, 0, -1 ); |
315 | 315 | } |
316 | 316 | |
| 317 | /** |
| 318 | * Output a comma-separated list of field IDs that are to be submitted on profile edit. |
| 319 | * |
| 320 | * @since BuddyPress (2.1.0) |
| 321 | */ |
| 322 | function bp_the_profile_field_ids() { |
| 323 | echo bp_get_the_profile_field_ids(); |
| 324 | } |
| 325 | /** |
| 326 | * Generate a comma-separated list of field IDs that are to be submitted on profile edit. |
| 327 | * |
| 328 | * @since BuddyPress (2.1.0) |
| 329 | * |
| 330 | * @return string |
| 331 | */ |
| 332 | function bp_get_the_profile_field_ids() { |
| 333 | global $profile_template; |
| 334 | |
| 335 | $field_ids = array(); |
| 336 | foreach ( $profile_template->groups as $group ) { |
| 337 | $field_ids = array_merge( $field_ids, wp_list_pluck( $group->fields, 'id' ) ); |
| 338 | } |
| 339 | |
| 340 | $field_ids = implode( ',', wp_parse_id_list( $field_ids ) ); |
| 341 | |
| 342 | return apply_filters( 'bp_get_tthe_profile_field_ids', $field_ids ); |
| 343 | } |
| 344 | |
317 | 345 | function bp_profile_fields() { |
318 | 346 | global $profile_template; |
319 | 347 | return $profile_template->profile_fields(); |