Skip to:

02/08/2016 04:52:44 PM (6 years ago)

Introduced 'Autolink' setting for XProfile fields.

Since BP 1.1, XProfile fields have been "autolinked". This means that a user's
entry for profile fields is linked to a search of the Members directory, using
that field's value as a search term. For short values - say, "Wichita, KS" for
the field "City" - the entire field value would be a link to a member search
on the phrase "Wichita, KS". For longer values, as in a multiline text field,
an algorithm detects "lists" (words between commas) and creates links
from them.

This feature was intended to aid in user discovery and serendipity. Sometimes
it works. But sometimes it makes very little sense.

This changeset introduces the ability for administrators to configure this
setting, on a per-field basis.

  • The new Autolink metabox on the XProfile Field Admin panel lets admin enable or disable the feature.
  • Smart defaults are pre-selected for new fields, or fields for which no value has yet to be saved. Namely: "multi fields" like checkboxes and radio buttons have Autolink enabled by default, while "single fields" have it disabled.

Props LenLay, sooskriszta, jeffsayre, boonebgorges.
Fixes #787.

1 edited


  • trunk/src/bp-xprofile/bp-xprofile-filters.php

    r10487 r10557  
    329329 * - Not run on values without commas with less than 5 words.
    330330 * - URL's are made clickable.
    331  * - To disable: remove_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_link_profile_data', 9, 2 );
     331 *
     332 * To disable globally:
     333 *     remove_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_link_profile_data', 9, 3 );
     334 *
     335 * To disable for a single field, use the 'Autolink' settings in Dashboard > Users > Profile Fields.
    332336 *
    333337 * @since 1.1.0
    338342 */
    339343function xprofile_filter_link_profile_data( $field_value, $field_type = 'textbox' ) {
     344    global $field;
     346    if ( ! $field->get_do_autolink() ) {
     347        return $field_value;
     348    }
    341350    if ( 'datebox' === $field_type ) {
Note: See TracChangeset for help on using the changeset viewer.