Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/08/2016 04:52:44 PM (6 years ago)
Author:
boonebgorges
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-xprofile/bp-xprofile-cssjs.php

    r10417 r10557  
    5353        $strings = array(
    5454            'supports_options_field_types' => array(),
     55            'do_autolink' => '',
    5556        );
    5657
     
    6263        }
    6364
     65        // Load 'autolink' setting into JS so that we can provide smart defaults when switching field type.
     66        if ( ! empty( $_GET['field_id'] ) ) {
     67            $field_id = intval( $_GET['field_id'] );
     68
     69            // Pull the raw data from the DB so we can tell whether the admin has saved a value yet.
     70            $strings['do_autolink'] = bp_xprofile_get_meta( $field_id, 'field', 'do_autolink' );
     71        }
     72
    6473        wp_localize_script( 'xprofile-admin-js', 'XProfileAdmin', $strings );
    6574    }
Note: See TracChangeset for help on using the changeset viewer.