Skip to:
Content

BuddyPress.org

Changeset 7122


Ignore:
Timestamp:
05/28/2013 03:48:47 AM (12 years ago)
Author:
boonebgorges
Message:

Introduces bp_get_the_profile_field_errors_action()

This convenience function concatenates an action name for use in rendering the
errors associated with a given xprofile field during registration.

Previously, the action name was concatenated inline, using the _field_name_
value. This caused problems in the case of multiselect fields, which have a
field name appended with '[]' for other reasons. See #2173

Fixes #4978

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-templates/bp-legacy/buddypress/members/register.php

    r6975 r7122  
    7070
    7171                                <label for="<?php bp_the_profile_field_input_name(); ?>"><?php bp_the_profile_field_name(); ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ); ?><?php endif; ?></label>
    72                                 <?php do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' ); ?>
     72                                <?php do_action( bp_get_the_profile_field_errors_action() ); ?>
    7373                                <input type="text" name="<?php bp_the_profile_field_input_name(); ?>" id="<?php bp_the_profile_field_input_name(); ?>" value="<?php bp_the_profile_field_edit_value(); ?>" />
    7474
     
    7878
    7979                                <label for="<?php bp_the_profile_field_input_name(); ?>"><?php bp_the_profile_field_name(); ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ); ?><?php endif; ?></label>
    80                                 <?php do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' ); ?>
     80                                <?php do_action( bp_get_the_profile_field_errors_action() ); ?>
    8181                                <textarea rows="5" cols="40" name="<?php bp_the_profile_field_input_name(); ?>" id="<?php bp_the_profile_field_input_name(); ?>"><?php bp_the_profile_field_edit_value(); ?></textarea>
    8282
     
    8686
    8787                                <label for="<?php bp_the_profile_field_input_name(); ?>"><?php bp_the_profile_field_name(); ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ); ?><?php endif; ?></label>
    88                                 <?php do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' ); ?>
     88                                <?php do_action( bp_get_the_profile_field_errors_action() ); ?>
    8989                                <select name="<?php bp_the_profile_field_input_name(); ?>" id="<?php bp_the_profile_field_input_name(); ?>">
    9090                                    <?php bp_the_profile_field_options(); ?>
     
    9696
    9797                                <label for="<?php bp_the_profile_field_input_name(); ?>"><?php bp_the_profile_field_name(); ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ); ?><?php endif; ?></label>
    98                                 <?php do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' ); ?>
     98                                <?php do_action( bp_get_the_profile_field_errors_action() ); ?>
    9999                                <select name="<?php bp_the_profile_field_input_name(); ?>" id="<?php bp_the_profile_field_input_name(); ?>" multiple="multiple">
    100100                                    <?php bp_the_profile_field_options(); ?>
     
    108108                                    <span class="label"><?php bp_the_profile_field_name(); ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ); ?><?php endif; ?></span>
    109109
    110                                     <?php do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' ); ?>
     110                                    <?php do_action( bp_get_the_profile_field_errors_action() ); ?>
    111111                                    <?php bp_the_profile_field_options(); ?>
    112112
     
    123123                                    <span class="label"><?php bp_the_profile_field_name(); ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ); ?><?php endif; ?></span>
    124124
    125                                     <?php do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' ); ?>
     125                                    <?php do_action( bp_get_the_profile_field_errors_action() ); ?>
    126126                                    <?php bp_the_profile_field_options(); ?>
    127127                                </div>
     
    133133                                <div class="datebox">
    134134                                    <label for="<?php bp_the_profile_field_input_name(); ?>_day"><?php bp_the_profile_field_name(); ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ); ?><?php endif; ?></label>
    135                                     <?php do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' ); ?>
     135                                    <?php do_action( bp_get_the_profile_field_errors_action() ); ?>
    136136
    137137                                    <select name="<?php bp_the_profile_field_input_name(); ?>_day" id="<?php bp_the_profile_field_input_name(); ?>_day">
  • trunk/bp-themes/bp-default/registration/register.php

    r6994 r7122  
    7575
    7676                                    <label for="<?php bp_the_profile_field_input_name(); ?>"><?php bp_the_profile_field_name(); ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ); ?><?php endif; ?></label>
    77                                     <?php do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' ); ?>
     77                                    <?php do_action( bp_get_the_profile_field_errors_action() ); ?>
    7878                                    <input type="text" name="<?php bp_the_profile_field_input_name(); ?>" id="<?php bp_the_profile_field_input_name(); ?>" value="<?php bp_the_profile_field_edit_value(); ?>" />
    7979
     
    8383
    8484                                    <label for="<?php bp_the_profile_field_input_name(); ?>"><?php bp_the_profile_field_name(); ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ); ?><?php endif; ?></label>
    85                                     <?php do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' ); ?>
     85                                    <?php do_action( bp_get_the_profile_field_errors_action() ); ?>
    8686                                    <textarea rows="5" cols="40" name="<?php bp_the_profile_field_input_name(); ?>" id="<?php bp_the_profile_field_input_name(); ?>"><?php bp_the_profile_field_edit_value(); ?></textarea>
    8787
     
    9191
    9292                                    <label for="<?php bp_the_profile_field_input_name(); ?>"><?php bp_the_profile_field_name(); ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ); ?><?php endif; ?></label>
    93                                     <?php do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' ); ?>
     93                                    <?php do_action( bp_get_the_profile_field_errors_action() ); ?>
    9494                                    <select name="<?php bp_the_profile_field_input_name(); ?>" id="<?php bp_the_profile_field_input_name(); ?>">
    9595                                        <?php bp_the_profile_field_options(); ?>
     
    101101
    102102                                    <label for="<?php bp_the_profile_field_input_name(); ?>"><?php bp_the_profile_field_name(); ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ); ?><?php endif; ?></label>
    103                                     <?php do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' ); ?>
     103                                    <?php do_action( bp_get_the_profile_field_errors_action() ); ?>
    104104                                    <select name="<?php bp_the_profile_field_input_name(); ?>" id="<?php bp_the_profile_field_input_name(); ?>" multiple="multiple">
    105105                                        <?php bp_the_profile_field_options(); ?>
     
    113113                                        <span class="label"><?php bp_the_profile_field_name(); ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ); ?><?php endif; ?></span>
    114114
    115                                         <?php do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' ); ?>
     115                                        <?php do_action( bp_get_the_profile_field_errors_action() ); ?>
    116116                                        <?php bp_the_profile_field_options(); ?>
    117117
     
    128128                                        <span class="label"><?php bp_the_profile_field_name(); ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ); ?><?php endif; ?></span>
    129129
    130                                         <?php do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' ); ?>
     130                                        <?php do_action( bp_get_the_profile_field_errors_action() ); ?>
    131131                                        <?php bp_the_profile_field_options(); ?>
    132132                                    </div>
     
    138138                                    <div class="datebox">
    139139                                        <label for="<?php bp_the_profile_field_input_name(); ?>_day"><?php bp_the_profile_field_name(); ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ); ?><?php endif; ?></label>
    140                                         <?php do_action( 'bp_' . bp_get_the_profile_field_input_name() . '_errors' ); ?>
     140                                        <?php do_action( bp_get_the_profile_field_errors_action() ); ?>
    141141
    142142                                        <select name="<?php bp_the_profile_field_input_name(); ?>_day" id="<?php bp_the_profile_field_input_name(); ?>_day">
  • trunk/bp-xprofile/bp-xprofile-template.php

    r6415 r7122  
    387387        return apply_filters( 'bp_get_the_profile_field_input_name', 'field_' . $field->id . $array_box );
    388388    }
     389
     390/**
     391 * Returns the action name for any signup errors related to this profile field
     392 *
     393 * In the registration templates, signup errors are pulled from the global
     394 * object and rendered at actions that look like 'bp_field_12_errors'. This
     395 * function allows the action name to be easily concatenated and called in the
     396 * following fashion:
     397 *   do_action( bp_get_the_profile_field_errors_action() );
     398 *
     399 * @since BuddyPress (1.8)
     400 * @return string The _errors action name corresponding to this profile field
     401 */
     402function bp_get_the_profile_field_errors_action() {
     403    global $field;
     404    return 'bp_field_' . $field->id . '_errors';
     405}
    389406
    390407/**
Note: See TracChangeset for help on using the changeset viewer.