[buddypress-trac] [BuddyPress Trac] #7068: Enable $multi_format option in bp_get_profile_field_data

buddypress-trac noreply at wordpress.org
Tue May 17 17:46:33 UTC 2016


#7068: Enable $multi_format option in bp_get_profile_field_data
----------------------------------+-----------------------------
 Reporter:  garrett-eclipse       |      Owner:
     Type:  defect (bug)          |     Status:  new
 Priority:  normal                |  Milestone:  Awaiting Review
Component:  Component - XProfile  |    Version:  2.5.0
 Severity:  normal                |   Keywords:
----------------------------------+-----------------------------
 Currently the bp_get_profile_field_data function only supports use of
 field and user_id which is passed into xprofile_get_field_data through the
 bp_get_profile_field_data filter. The xprofile_get_field_data function
 supports a $multi_format argument which defaults to 'array' it does
 support 'comma' as well. I would like the ability to specify this argument
 introduced into the bp_get_profile_field_data function as follows;

 {{{#!php
 <?php
 /**
  * Output XProfile field data.
  *
  * @since 1.2.0
  *
  * @param string|array $args Array of arguments for field data. See {@link
 bp_get_profile_field_data}
  */
 function bp_profile_field_data( $args = '' ) {
         echo bp_get_profile_field_data( $args );
 }
         /**
          * Return XProfile field data.
          *
          * @since 1.2.0
          *
          * @param string|array $args {
          *    Array of arguments for field data.
          *
          *    @type string|int|bool $field   Field identifier.
          *    @type int             $user_id ID of the user to get field
 data for.
          *    @type string        $multi_format How should array data be
 returned?
          *                                'comma' if you want a comma-
 separated string; 'array' if you want an array.
          * }
      * @return mixed|void
          */
         function bp_get_profile_field_data( $args = '' ) {
                 $r = wp_parse_args( $args, array(
                         'field'   => false, // Field name or ID.
                         'user_id' => bp_displayed_user_id(),
                         'multi_format' => 'array'
                 ) );
                 /**
                  * Filters the profile field data.
                  *
                  * @since 1.2.0
                  *
                  * @param mixed $value Profile data for a specific field
 for the user.
                  */
                 return apply_filters( 'bp_get_profile_field_data',
 xprofile_get_field_data( $r['field'], $r['user_id'], $r['multi_format'] )
 );
         }
 }}}

 Thank you

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7068>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list