Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/01/2014 10:33:57 PM (12 years ago)
Author:
djpaul
Message:

xProfile: prevent duplicate profile field templating when using pre-2.0 custom field types.

Prior to the xProfile field type overhaul in 2.0, plugins that added custom field types had to do so with a variety of actions.
One such plugin is "Buddypress Xprofile Custom Fields Type" and the changes in 2.0 caused an issue where the plugin's custom
templating was being rendered, alongside BuddyPress' profile field fallback type, the textbox.

BuddyPress uses a fallback field type to handle situations when extra profile types/data are provided by another plugin, and
then that plugin is removed. The original idea was that everything would fallback to rendering a textbox if a field type was
unregistered to give at least some kind of access to that profile field's data, but in practice this has caused a couple of
issues with templating, as this commit addresses.

This change essentially reverts the fallback behaviour to the pre-2.0 implementation: if a custom field type is unknown to
BuddyPress, that field simply won't be rendered.

Fixes #5589

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-xprofile/bp-xprofile-functions.php

    r8178 r8336  
    9696
    9797    /**
    98      * For backpat and to handle (missing) field types introduced by other plugins, fallback to
    99      * textbox if a type is unknown. Textbox validation and display is intentionally low key.
     98     * To handle (missing) field types, fallback to a placeholder field object if a type is unknown.
    10099     */
    101100    if ( $class && class_exists( $class ) ) {
    102101        return new $class;
    103102    } else {
    104         return new BP_XProfile_Field_Type_Textbox;
     103        return new BP_XProfile_Field_Type_Placeholder;
    105104    }
    106105}
Note: See TracChangeset for help on using the changeset viewer.