Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/07/2015 03:34:32 PM (9 years ago)
Author:
boonebgorges
Message:

Pass field ID to xprofile field type filter methods.

display_filter() and pre_validate_filter() are more useful if they receive
the field ID. So we pass it, when available.

See #5625.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-xprofile/classes/class-bp-xprofile-field-type-url.php

    r10179 r10203  
    125125     *
    126126     * @since 2.1.0
     127     * @since 2.4.0 Added the `$field_id` parameter.
    127128     *
    128129     * @param string $submitted_value Raw value submitted by the user.
     130     * @param int    $field_id        Optional. ID of the field.
    129131     *
    130132     * @return string
    131133     */
    132     public static function pre_validate_filter( $submitted_value = '' ) {
     134    public static function pre_validate_filter( $submitted_value = '', $field_id = '' ) {
    133135
    134136        // Allow empty URL values.
     
    153155     *
    154156     * @since 2.1.0
     157     * @since 2.4.0 Added the `$field_id` parameter.
    155158     *
    156159     * @param string $field_value The URL value, as saved in the database.
     160     * @param int    $field_id    Optional. ID of the field.
    157161     *
    158162     * @return string URL converted to a link.
    159163     */
    160     public static function display_filter( $field_value ) {
     164    public static function display_filter( $field_value, $field_id = '' ) {
    161165        $link      = strip_tags( $field_value );
    162166        $no_scheme = preg_replace( '#^https?://#', '', rtrim( $link, '/' ) );
Note: See TracChangeset for help on using the changeset viewer.