Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/01/2014 10:33:57 PM (11 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-classes.php

    r8298 r8336  
    24982498
    24992499/**
     2500 * A placeholder xprofile field type. Doesn't do anything.
     2501 *
     2502 * Used if an existing field has an unknown type (e.g. one provided by a missing third-party plugin).
     2503 *
     2504 * @since BuddyPress (2.0.1)
     2505 */
     2506class BP_XProfile_Field_Type_Placeholder extends BP_XProfile_Field_Type {
     2507
     2508    /**
     2509     * Constructor for the placeholder field type.
     2510     *
     2511     * @since BuddyPress (2.0.1)
     2512     */
     2513    public function __construct() {
     2514    }
     2515
     2516    /**
     2517     * Prevent any HTML being output for this field type.
     2518     *
     2519     * @param array $raw_properties Optional key/value array of {@link http://dev.w3.org/html5/markup/input.text.html permitted attributes} that you want to add.
     2520     * @since BuddyPress (2.0.1)
     2521     */
     2522    public function edit_field_html( array $raw_properties = array() ) {
     2523    }
     2524
     2525    /**
     2526     * Prevent any HTML being output for this field type.
     2527     *
     2528     * @param array $raw_properties Optional key/value array of permitted attributes that you want to add.
     2529     * @since BuddyPress (2.0.1)
     2530     */
     2531    public function admin_field_html( array $raw_properties = array() ) {
     2532    }
     2533
     2534    /**
     2535     * Prevent any HTML being output for this field type.
     2536     *
     2537     * @param BP_XProfile_Field $current_field The current profile field on the add/edit screen.
     2538     * @param string $control_type Optional. HTML input type used to render the current field's child options.
     2539     * @since BuddyPress (2.0.1)
     2540     */
     2541    public function admin_new_field_html( BP_XProfile_Field $current_field, $control_type = '' ) {}
     2542}
     2543
     2544/**
    25002545 * Represents a type of XProfile field and holds meta information about the type of value that it accepts.
    25012546 *
Note: See TracChangeset for help on using the changeset viewer.