Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/10/2009 11:37:23 PM (16 years ago)
Author:
apeatling
Message:

Fixed automatic profile field filtering so that URL's are linked as URL's and not as search terms.

File:
1 edited

Legend:

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

    r1052 r1055  
    2929}
    3030
    31 
    3231function xprofile_filter_link_profile_data( $field_value, $field_type, $field_id ) {
    3332    if ( 'datebox' == $field_type )
     
    4342            $value = trim( $value );
    4443           
    45             if ( count( explode( ' ', $value ) ) > 5 )
    46                 $new_values[] = $value;
    47             else
    48                 $new_values[] = '<a href="' . site_url(MEMBERS_SLUG) . '/?s=' . $value . '">' . $value . '</a>';
     44            /* If the value is a URL, skip it and just make it clickable. */
     45            if ( preg_match( '@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@', $value ) ) {
     46                $new_values[] = make_clickable( $value );
     47            } else {
     48                if ( count( explode( ' ', $value ) ) > 5 )
     49                    $new_values[] = $value;
     50                else
     51                    $new_values[] = '<a href="' . site_url( MEMBERS_SLUG ) . '/?s=' . $value . '">' . $value . '</a>';
     52            }
    4953        }
    5054       
Note: See TracChangeset for help on using the changeset viewer.