Skip to:
Content

BuddyPress.org

Ticket #5666: 5666.02.patch

File 5666.02.patch, 3.6 KB (added by boonebgorges, 11 years ago)
  • src/bp-templates/bp-legacy/buddypress/members/single/profile/edit.php

    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() ) ) 
    6363                <input type="submit" name="profile-group-edit-submit" id="profile-group-edit-submit" value="<?php esc_attr_e( 'Save Changes', 'buddypress' ); ?> " />
    6464        </div>
    6565
    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(); ?>" />
    6767
    6868        <?php wp_nonce_field( 'bp_xprofile_edit' ); ?>
    6969
  • src/bp-templates/bp-legacy/buddypress/members/single/settings/profile.php

    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
     
    4646
    4747        <?php wp_nonce_field( 'bp_xprofile_settings' ); ?>
    4848
    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(); ?>" />
    5050
    5151</form>
    5252
  • src/bp-xprofile/bp-xprofile-actions.php

    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() { 
    8585                // Get the POST'ed field ID's
    8686                $posted_field_ids = explode( ',', $_POST['field_ids'] );
    8787
     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
    8899                // Save the visibility settings
    89100                foreach ( $posted_field_ids as $field_id ) {
    90101
  • src/bp-xprofile/bp-xprofile-template.php

    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() { 
    314314                return substr( $field_ids, 0, -1 );
    315315        }
    316316
     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 */
     322function 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
    317345function bp_profile_fields() {
    318346        global $profile_template;
    319347        return $profile_template->profile_fields();