mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-11 18:56:10 +09:00
- fixed PHP errors when some custom registered fields are displayed without registration;
This commit is contained in:
@@ -1513,24 +1513,24 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get field label
|
||||
*
|
||||
* @param string $key
|
||||
* @param string $key Field meta key
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function get_label( $key ) {
|
||||
$label = '';
|
||||
public function get_label( $key ) {
|
||||
$label = '';
|
||||
$fields = UM()->builtin()->all_user_fields;
|
||||
$field_data = array_key_exists( $key, $fields ) ? $fields[ $key ] : array();
|
||||
|
||||
$fields = UM()->builtin()->all_user_fields;
|
||||
if ( isset( $fields[ $key ]['label'] ) ) {
|
||||
$label = stripslashes( $fields[ $key ]['label'] );
|
||||
if ( array_key_exists( 'label', $field_data ) ) {
|
||||
$label = stripslashes( $field_data['label'] );
|
||||
}
|
||||
|
||||
if ( empty( $label ) && isset( $fields[ $key ]['title'] ) ) {
|
||||
$label = stripslashes( $fields[ $key ]['title'] );
|
||||
if ( empty( $label ) && array_key_exists( 'title', $field_data ) ) {
|
||||
$label = stripslashes( $field_data['title'] );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1556,13 +1556,11 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
* }
|
||||
* add_filter( 'um_change_field_label', 'my_change_field_label', 10, 3 );
|
||||
*/
|
||||
$label = apply_filters( 'um_change_field_label', $label, $key, $fields[ $key ] );
|
||||
$label = apply_filters( 'um_change_field_label', $label, $key, $field_data );
|
||||
|
||||
$label = sprintf( __( '%s', 'ultimate-member' ), $label );
|
||||
return $label;
|
||||
return sprintf( __( '%s', 'ultimate-member' ), $label );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get field title
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user