[buddypress-trac] [BuddyPress Trac] #8083: Add Age option to BP Xprofile Databox

buddypress-trac noreply at wordpress.org
Sun Apr 21 12:30:15 UTC 2019


#8083: Add Age option to BP Xprofile Databox
------------------------------+-----------------------------
 Reporter:  Venutius          |      Owner:  (none)
     Type:  enhancement       |     Status:  new
 Priority:  normal            |  Milestone:  Awaiting Review
Component:  Extended Profile  |    Version:
 Severity:  normal            |   Keywords:
------------------------------+-----------------------------
 The BP datebox xProfile field has an elapsed time option but not an age
 option. I'd like to suggest we fill this missing hole as many BP's would
 probably prefer to display their age rather than their DoB. I think this
 could be an easy add, we just need to duplicate the elapsed time options
 and update them for age. I think the changes need to be made in a couple
 of places:

 In class-bp-xprofile-field-type-datebox.php:

 Line 478 insert:

 {{{
 <div class="bp-date-format-option">
     <label for="date-format-age">
         <input type="radio" name="field-settings[date_format]" id="date-
 format-age" <?php checked( 'age', $settings['date_format'] ); ?>
 value="age" aria-describedby="date-format-age-setting" />
         <span class="date-format-label" id="date-format-age-setting"><?php
 esc_html_e( 'Age', 'bp-xprofile-age-field' ); ?></span> <?php _e( '<code>4
 years old</code>', 'bp-xprofile-age-field' ); ?>
     </label>
 </div>

 }}}

 On line 600 insert:

 {{{
 case 'age' :
     add_filter( 'bp_core_time_since_ago_text', function($text){ return '%s
 old'; } );
     $formatted = bp_core_time_since( $field_value );
     remove_filter( 'bp_core_time_since_ago_text', function($text){ return
 '%s old'; } );
     break;

 }}}

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


More information about the buddypress-trac mailing list