mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +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
|
||||
*
|
||||
|
||||
@@ -456,7 +456,7 @@ function um_profile_field_filter_hook__( $value, $data, $type = '' ) {
|
||||
$value = '<a href="' . esc_url( $value, $protocols ) . '" title="' . esc_attr( $alt ) . '" target="' . esc_attr( $data['url_target'] ) . '" ' . $url_rel . '>' . esc_html( $alt ) . '</a>';
|
||||
} else {
|
||||
// check $value is oEmbed
|
||||
if ( 'oembed' === $data['type'] ) {
|
||||
if ( array_key_exists( 'type', $data ) && 'oembed' === $data['type'] ) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user