mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
- updated Info window fields (hide fields without metakeys);
This commit is contained in:
@@ -576,4 +576,110 @@ function um_select_if_in_query_params( $filter, $val ) {
|
||||
}
|
||||
|
||||
echo $selected ? 'selected="selected"' : '';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get submitted user information
|
||||
*
|
||||
* @param bool $style
|
||||
*
|
||||
* @return null|string
|
||||
*
|
||||
* @deprecated 2.1.3
|
||||
*/
|
||||
function um_user_submitted_registration( $style = false ) {
|
||||
$output = null;
|
||||
|
||||
$data = um_user( 'submitted' );
|
||||
|
||||
if ( $style ) {
|
||||
$output .= '<div class="um-admin-infobox">';
|
||||
}
|
||||
|
||||
if ( isset( $data ) && is_array( $data ) ) {
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_email_registration_data
|
||||
* @description Prepare Registration data to email
|
||||
* @input_vars
|
||||
* [{"var":"$data","type":"array","desc":"Registration Data"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_email_registration_data', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_email_registration_data', 'my_email_registration_data', 10, 1 );
|
||||
* function my_email_registration_data( $data ) {
|
||||
* // your code here
|
||||
* return $data;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$data = apply_filters( 'um_email_registration_data', $data );
|
||||
|
||||
$pw_fields = array();
|
||||
foreach ( $data as $k => $v ) {
|
||||
|
||||
if ( strstr( $k, 'user_pass' ) || in_array( $k, array( 'g-recaptcha-response', 'request', '_wpnonce', '_wp_http_referer' ) ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( UM()->fields()->get_field_type( $k ) == 'password' ) {
|
||||
$pw_fields[] = $k;
|
||||
$pw_fields[] = 'confirm_' . $k;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( ! empty( $pw_fields ) && in_array( $k, $pw_fields ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( UM()->fields()->get_field_type( $k ) == 'image' || UM()->fields()->get_field_type( $k ) == 'file' ) {
|
||||
$file = basename( $v );
|
||||
$filedata = get_user_meta( um_user( 'ID' ), $k . "_metadata", true );
|
||||
|
||||
$baseurl = UM()->uploader()->get_upload_base_url();
|
||||
if ( ! file_exists( UM()->uploader()->get_upload_base_dir() . um_user( 'ID' ) . DIRECTORY_SEPARATOR . $file ) ) {
|
||||
if ( is_multisite() ) {
|
||||
//multisite fix for old customers
|
||||
$baseurl = str_replace( '/sites/' . get_current_blog_id() . '/', '/', $baseurl );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! empty( $filedata['original_name'] ) ) {
|
||||
$v = '<a href="' . esc_attr( $baseurl . um_user( 'ID' ) . '/' . $file ) . '">' . esc_html( $filedata['original_name'] ) . '</a>';
|
||||
} else {
|
||||
$v = $baseurl . um_user( 'ID' ) . '/' . $file;
|
||||
}
|
||||
}
|
||||
|
||||
if ( is_array( $v ) ) {
|
||||
$v = implode( ',', $v );
|
||||
}
|
||||
|
||||
if ( $k == 'timestamp' ) {
|
||||
$k = __( 'date submitted', 'ultimate-member' );
|
||||
$v = date( "d M Y H:i", $v );
|
||||
}
|
||||
|
||||
if ( $style ) {
|
||||
if ( ! $v ) {
|
||||
$v = __( '(empty)', 'ultimate-member' );
|
||||
}
|
||||
$output .= "<p><label>$k</label><span>$v</span></p>";
|
||||
} else {
|
||||
$output .= "$k: $v" . "<br />";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $style ) {
|
||||
$output .= '</div>';
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
@@ -666,111 +666,6 @@ function um_get_snippet( $str, $wordCount = 10 ) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get submitted user information
|
||||
*
|
||||
* @param bool $style
|
||||
*
|
||||
* @return null|string
|
||||
*
|
||||
* @deprecated 2.1.3
|
||||
*/
|
||||
function um_user_submitted_registration( $style = false ) {
|
||||
$output = null;
|
||||
|
||||
$data = um_user( 'submitted' );
|
||||
|
||||
if ( $style ) {
|
||||
$output .= '<div class="um-admin-infobox">';
|
||||
}
|
||||
|
||||
if ( isset( $data ) && is_array( $data ) ) {
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_email_registration_data
|
||||
* @description Prepare Registration data to email
|
||||
* @input_vars
|
||||
* [{"var":"$data","type":"array","desc":"Registration Data"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_email_registration_data', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_email_registration_data', 'my_email_registration_data', 10, 1 );
|
||||
* function my_email_registration_data( $data ) {
|
||||
* // your code here
|
||||
* return $data;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$data = apply_filters( 'um_email_registration_data', $data );
|
||||
|
||||
$pw_fields = array();
|
||||
foreach ( $data as $k => $v ) {
|
||||
|
||||
if ( strstr( $k, 'user_pass' ) || in_array( $k, array( 'g-recaptcha-response', 'request', '_wpnonce', '_wp_http_referer' ) ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( UM()->fields()->get_field_type( $k ) == 'password' ) {
|
||||
$pw_fields[] = $k;
|
||||
$pw_fields[] = 'confirm_' . $k;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( ! empty( $pw_fields ) && in_array( $k, $pw_fields ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( UM()->fields()->get_field_type( $k ) == 'image' || UM()->fields()->get_field_type( $k ) == 'file' ) {
|
||||
$file = basename( $v );
|
||||
$filedata = get_user_meta( um_user( 'ID' ), $k . "_metadata", true );
|
||||
|
||||
$baseurl = UM()->uploader()->get_upload_base_url();
|
||||
if ( ! file_exists( UM()->uploader()->get_upload_base_dir() . um_user( 'ID' ) . DIRECTORY_SEPARATOR . $file ) ) {
|
||||
if ( is_multisite() ) {
|
||||
//multisite fix for old customers
|
||||
$baseurl = str_replace( '/sites/' . get_current_blog_id() . '/', '/', $baseurl );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! empty( $filedata['original_name'] ) ) {
|
||||
$v = '<a href="' . esc_attr( $baseurl . um_user( 'ID' ) . '/' . $file ) . '">' . esc_html( $filedata['original_name'] ) . '</a>';
|
||||
} else {
|
||||
$v = $baseurl . um_user( 'ID' ) . '/' . $file;
|
||||
}
|
||||
}
|
||||
|
||||
if ( is_array( $v ) ) {
|
||||
$v = implode( ',', $v );
|
||||
}
|
||||
|
||||
if ( $k == 'timestamp' ) {
|
||||
$k = __( 'date submitted', 'ultimate-member' );
|
||||
$v = date( "d M Y H:i", $v );
|
||||
}
|
||||
|
||||
if ( $style ) {
|
||||
if ( ! $v ) {
|
||||
$v = __( '(empty)', 'ultimate-member' );
|
||||
}
|
||||
$output .= "<p><label>$k</label><span>$v</span></p>";
|
||||
} else {
|
||||
$output .= "$k: $v" . "<br />";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $style ) {
|
||||
$output .= '</div>';
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format submitted data for Info preview & Email template
|
||||
* @param boolean $style
|
||||
@@ -941,7 +836,7 @@ function um_user_submitted_registration_formatted( $style = false ) {
|
||||
function um_user_submited_display( $k, $title, $data = array(), $style = true ) {
|
||||
$output = '';
|
||||
|
||||
if ( 'form_id' == $k && isset( $data['form_id'] ) && ! empty( $data['form_id'] ) ) {
|
||||
if ( 'form_id' == $k && isset( $data['form_id'] ) && ! empty( $data['form_id'] ) ) {
|
||||
$v = sprintf( __( '%s - Form ID#: %s', 'ultimate-member' ), get_the_title( $data['form_id'] ), $data['form_id'] );
|
||||
} else {
|
||||
$v = um_user( $k );
|
||||
@@ -951,6 +846,12 @@ function um_user_submited_display( $k, $title, $data = array(), $style = true )
|
||||
return '';
|
||||
}
|
||||
|
||||
$fields_without_metakey = UM()->builtin()->get_fields_without_metakey();
|
||||
$type = UM()->fields()->get_field_type( $k );
|
||||
if ( in_array( $type, $fields_without_metakey ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ( ! $v ) {
|
||||
if ( $style ) {
|
||||
return "<p><label>$title: </label><span>" . __( '(empty)', 'ultimate-member' ) ."</span></p>";
|
||||
@@ -959,7 +860,7 @@ function um_user_submited_display( $k, $title, $data = array(), $style = true )
|
||||
}
|
||||
}
|
||||
|
||||
if ( UM()->fields()->get_field_type( $k ) == 'image' || UM()->fields()->get_field_type( $k ) == 'file' ) {
|
||||
if ( $type == 'image' || $type == 'file' ) {
|
||||
$file = basename( $v );
|
||||
|
||||
$filedata = get_user_meta( um_user( 'ID' ), $k . "_metadata", true );
|
||||
|
||||
Reference in New Issue
Block a user