get_user_meta_by_prefix( $user_id, 'user_registration_' ); $form_fields = $this->get_form_fields( $all_meta_for_user, $form_id ); if ( ! empty( $form_fields ) ) { foreach ( $form_fields as $key => $value ) { if ( isset( $value['field_key'] ) && 'signature' === $value['field_key'] && isset( $_GET['user_id'] ) ) { unset( $form_fields[ $key ] ); } if( isset( $value['field_key'] ) && 'membership' === $value['field_key'] && isset( $_GET['user_id'] )) { unset( $form_fields[ $key ] ); } } unset( $form_fields['user_registration_profile_pic_url'] ); if ( ! empty( $form_fields ) ) { /** * Filter to retrieve the profile meta fields * * @param array Array of Profile Meta Fields */ $show_fields = apply_filters( 'user_registration_profile_meta_fields', array( 'user_registration' => array( 'title' => sprintf( esc_html__( 'User Extra Information', 'user-registration' ), '' ), 'fields' => $form_fields, ), ) ); } } return $show_fields; } /** * Add cus;tomer meta fields. * * @deprecated 1.4.1 * @param array $all_meta_value Meta value. * @param int $form_id Form id. */ public function add_customer_meta_fields( $all_meta_value, $form_id ) { ur_deprecated_function( 'UR_Admin_Profile::add_customer_meta_fields', '1.4.1', 'UR_Admin_Profile::show_user_extra_fields' ); } /** * Show user extra information in users profile page. * * @param WP_User $user Users Data. */ public function show_user_extra_fields( $user ) { /** * Filter Hook: user_registration_hide_user_extra_fields_to_non_admin * * Allow users without 'manage_options' capability to view and edit User Extra Details. * * @since 3.0.4 * * @param [bool] $hide Whether to hide details. * * @return bool */ if ( ! current_user_can( 'manage_options' ) && ! current_user_can( 'manage_user_registration', true ) ) { return; } $show_fields = $this->get_user_meta_by_form_fields( $user->ID ); $exclude_fields = $this->get_exclude_fields_for_admin_profile(); $form_id = ur_get_form_id_by_userid( $user->ID ); $profile = user_registration_form_data( $user->ID, $form_id ); foreach ( $show_fields as $fieldset_key => $fieldset ) : ?>
|
|
ID, $key ) && isset( $profile[ $key ] ) && isset( $profile[ $key ]['type'] ) && 'radio' === $profile[ $key ]['type'] ) {
$db_value = isset( $profile[ $key ]['default'] ) ? $profile[ $key ]['default'] : '';
} else {
$db_value = get_user_meta( $user->ID, $key, true );
}
if ( isset( $field['image_choice'] ) && ur_string_to_bool( $field['image_choice'] ) ) {
if ( is_array( $field['image_options'] ) ) {
foreach ( $field['image_options'] as $option_key => $option_value ) {
$label_option = is_array( $option_value ) ? $option_value['label'] : $option_value->label;
$image_option = is_array( $option_value ) ? $option_value['image'] : $option_value->image;
?>
$option_value ) {
?>
ID, $key ) && isset( $profile[ $key ] ) && isset( $profile[ $key ]['type'] ) && 'checkbox' === $profile[ $key ]['type'] ) { $value = isset( $profile[ $key ]['default'] ) ? $profile[ $key ]['default'] : ''; } else { $value = get_user_meta( $user->ID, $key, true ); } if ( isset( $field['image_choice'] ) && ur_string_to_bool( $field['image_choice'] ) && is_array( $field['image_options'] ) && array_filter( $field['image_options'] ) ) { foreach ( $field['image_options'] as $choice_key => $choice_value ) { $label_choice = is_array( $choice_value ) ? ur_sanitize_tooltip( trim( $choice_value['label'] ) ) : ur_sanitize_tooltip( trim( $choice_value->label ) ); $image_choice = is_array( $choice_value ) ? $choice_value['image'] : $choice_value->image; ?> > ID, $key ) && isset( $profile[ $key ] ) && isset( $profile[ $key ]['type'] ) && 'date' === $profile[ $key ]['type'] ) { $value = isset( $profile[ $key ]['default'] ) ? $profile[ $key ]['default'] : ''; if ( empty( $value ) && isset( $profile[ $key ]['custom_attributes']['data-default-date'] ) ) { $date_format = isset( $profile[ $key ]['custom_attributes']['data-date-format'] ) ? $profile[ $key ]['custom_attributes']['data-date-format'] : 'd/m/Y'; $default_date = isset( $profile[ $key ]['custom_attributes']['data-default-date'] ) ? absint( $profile[ $key ]['custom_attributes']['data-default-date'] ) : 1; if ( 1 === $default_date ) { $value = date( $date_format, time() ); } } } else { $value = $this->get_user_meta( $user->ID, $key ); } $actual_value = $value; $value = str_replace( '/', '-', $value ); if ( ! strpos( $value, 'to' ) ) { $value = '' !== $value ? date_i18n( $date_format, strtotime( $value ) ) : ''; } else { $date_range = explode( 'to', $value ); $value = date_i18n( $date_format, strtotime( trim( $date_range[0] ) ) ) . ' to ' . date_i18n( $date_format, strtotime( trim( $date_range[1] ) ) ); } ?> readonly /> /> $key, 'value' => $this->get_user_meta( $user->ID, $key ), 'attribute_string' => $attribute_string, 'field' => $field, ); /** * Action to display user extra field * * @param array $data Field Data */ do_action( 'user_registration_profile_field_' . $field['type'], $data ); else : $extra_params_key = str_replace( 'user_registration_', 'ur_', $key ) . '_params'; $extra_params = json_decode( get_user_meta( $user->ID, $extra_params_key, true ) ); if ( empty( $extra_params ) ) { if ( ! metadata_exists( 'user', $user->ID, $key ) && isset( $profile[ $key ] ) ) { $value = isset( $profile[ $key ]['default'] ) ? $profile[ $key ]['default'] : ''; } else { $value = $this->get_user_meta( $user->ID, $key ); } ?> /> |
|---|