Skip to:
Content

BuddyPress.org

Ticket #6521: 6521-concept.01.patch

File 6521-concept.01.patch, 2.5 KB (added by dcavins, 10 years ago)

Proof of concept.

  • src/bp-xprofile/bp-xprofile-admin.php

    diff --git src/bp-xprofile/bp-xprofile-admin.php src/bp-xprofile/bp-xprofile-admin.php
    index 55c4b6d..7540031 100644
    function xprofile_admin_field( $admin_field, $admin_group, $class = '' ) { 
    497497                                <?php bp_the_profile_field_name(); ?>
    498498
    499499                                <?php if ( empty( $field->can_delete )                                    ) : ?><?php esc_html_e( '(Primary)',  'buddypress' ); endif; ?>
    500                                 <?php if ( bp_get_the_profile_field_is_required()                         ) : ?><?php esc_html_e( '(Required)', 'buddypress' ); endif; ?>
     500                                <?php bp_the_profile_field_required_label(); ?>
    501501                                <?php if ( bp_xprofile_get_meta( $field->id, 'field', 'signup_position' ) ) : ?><?php esc_html_e( '(Sign-up)',  'buddypress' ); endif; ?>
    502502
    503503                                <?php
  • src/bp-xprofile/bp-xprofile-template.php

    diff --git src/bp-xprofile/bp-xprofile-template.php src/bp-xprofile/bp-xprofile-template.php
    index ba3ed15..990b03a 100644
    function bp_profile_settings_visibility_select( $args = '' ) { 
    13141314                 */
    13151315                return apply_filters( 'bp_profile_settings_visibility_select', $retval, $r, $args );
    13161316        }
     1317
     1318function bp_the_profile_field_required_label(){
     1319        echo bp_get_the_profile_field_required_label();
     1320}
     1321
     1322        function bp_get_the_profile_field_required_label(){
     1323                $retval = '';
     1324
     1325                if ( bp_get_the_profile_field_is_required() ) {
     1326                        $translated_string = __( ' (required)', 'buddypress' );
     1327
     1328                        $retval = '<span class="bp-required-field">';
     1329                        $retval .= apply_filters( 'bp_get_the_profile_field_required_label', $translated_string, bp_get_the_profile_field_id() );
     1330                        $retval .= '</span>';
     1331
     1332                }
     1333                return $retval;
     1334        }
  • src/bp-xprofile/classes/class-bp-xprofile-field-type-checkbox.php

    diff --git src/bp-xprofile/classes/class-bp-xprofile-field-type-checkbox.php src/bp-xprofile/classes/class-bp-xprofile-field-type-checkbox.php
    index 8801946..ea19625 100644
    class BP_XProfile_Field_Type_Checkbox extends BP_XProfile_Field_Type { 
    6666                <div class="checkbox">
    6767                        <label for="<?php bp_the_profile_field_input_name(); ?>">
    6868                                <?php bp_the_profile_field_name(); ?>
    69                                 <?php if ( bp_get_the_profile_field_is_required() ) : ?>
    70                                         <?php esc_html_e( '(required)', 'buddypress' ); ?>
    71                                 <?php endif; ?>
     69                                <?php bp_the_profile_field_required_label(); ?>
    7270                        </label>
    7371
    7472                        <?php