Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/28/2013 03:48:47 AM (9 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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.