Skip to:
Content

Changeset 5962


Ignore:
Timestamp:
04/06/12 22:50:30 (2 years ago)
Author:
boonebgorges
Message:

Adds multi_format parameter to xprofile_get_field_data(), so that values can be returned in a comma-separated string for easier theming. Fixes #4109

File:
1 edited

Legend:

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

    r5927 r5962  
    152152 * @param mixed $field The ID of the field, or the $name of the field. 
    153153 * @param int $user_id The ID of the user 
     154 * @param string $multi_format How should array data be returned? 'comma' if you want a  
     155 *   comma-separated string; 'array' if you want an array 
    154156 * @uses BP_XProfile_ProfileData::get_value_byid() Fetches the value based on the params passed. 
    155157 * @return mixed The profile field data. 
    156158 */ 
    157 function xprofile_get_field_data( $field, $user_id = 0 ) { 
     159function xprofile_get_field_data( $field, $user_id = 0, $multi_format = 'array' ) { 
    158160 
    159161    if ( empty( $user_id ) ) 
     
    177179        foreach( (array) $values as $value ) { 
    178180            $data[] = apply_filters( 'xprofile_get_field_data', $value, $field_id, $user_id ); 
     181        } 
     182         
     183        if ( 'comma' == $multi_format ) { 
     184            $data = implode( ', ', $data ); 
    179185        } 
    180186    } else { 
Note: See TracChangeset for help on using the changeset viewer.