mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
- fixed using callback for member directory fields;
- fixed "false" display name in the member directory. it displays empty for now; - fixed function for cleaning and sanitize arrays;
This commit is contained in:
@@ -387,7 +387,7 @@ if ( ! class_exists( 'UM_Functions' ) ) {
|
||||
if ( is_array( $var ) ) {
|
||||
return array_map( array( $this, 'clean_array' ), $var );
|
||||
} else {
|
||||
return is_scalar( $var ) ? sanitize_text_field( $var ) : $var;
|
||||
return ! is_scalar( $var ) ? sanitize_text_field( $var ) : $var;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -122,8 +122,6 @@ if ( ! class_exists( 'um\core\Form' ) ) {
|
||||
if ( isset( $arr_options['post']['members_directory'] ) && 'yes' === $arr_options['post']['members_directory'] ) {
|
||||
$ajax_source_func = $_POST['child_callback'];
|
||||
if ( function_exists( $ajax_source_func ) ) {
|
||||
$arr_options['items'] = call_user_func( $ajax_source_func, $arr_options['field']['parent_dropdown_relationship'] );
|
||||
|
||||
global $wpdb;
|
||||
|
||||
$values_array = $wpdb->get_col(
|
||||
@@ -137,7 +135,15 @@ if ( ! class_exists( 'um\core\Form' ) ) {
|
||||
);
|
||||
|
||||
if ( ! empty( $values_array ) ) {
|
||||
$arr_options['items'] = array_intersect( $arr_options['items'], $values_array );
|
||||
$arr_options['items'] = call_user_func( $ajax_source_func, $arr_options['field']['parent_dropdown_relationship'] );
|
||||
|
||||
if ( array_keys( $arr_options['items'] ) !== range( 0, count( $arr_options['items'] ) - 1 ) ) {
|
||||
// array with dropdown items is associative
|
||||
$arr_options['items'] = array_intersect_key( array_map( 'trim', $arr_options['items'] ), array_flip( $values_array ) );
|
||||
} else {
|
||||
// array with dropdown items has sequential numeric keys, starting from 0 and there are intersected values with $values_array
|
||||
$arr_options['items'] = array_intersect( $arr_options['items'], $values_array );
|
||||
}
|
||||
} else {
|
||||
$arr_options['items'] = array();
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ $unique_hash = substr( md5( $args['form_id'] ), 10, 5 ); ?>
|
||||
<?php if ( $cover_photos ) { ?>
|
||||
<div class="um-member-cover" data-ratio="<?php echo esc_attr( UM()->options()->get( 'profile_cover_ratio' ) ); ?>">
|
||||
<div class="um-member-cover-e">
|
||||
<a href="{{{user.profile_url}}}" title="{{{user.display_name}}}">
|
||||
<a href="{{{user.profile_url}}}" title="<# if ( user.display_name ) { #>{{{user.display_name}}}<# } #>">
|
||||
{{{user.cover_photo}}}
|
||||
</a>
|
||||
</div>
|
||||
@@ -27,7 +27,7 @@ $unique_hash = substr( md5( $args['form_id'] ), 10, 5 ); ?>
|
||||
|
||||
if ( $profile_photo ) { ?>
|
||||
<div class="um-member-photo radius-<?php echo esc_attr( UM()->options()->get( 'profile_photocorner' ) ); ?>">
|
||||
<a href="{{{user.profile_url}}}" title="{{{user.display_name}}}">
|
||||
<a href="{{{user.profile_url}}}" title="<# if ( user.display_name ) { #>{{{user.display_name}}}<# } #>">
|
||||
{{{user.avatar}}}
|
||||
<?php do_action( 'um_members_in_profile_photo_tmpl', $args ); ?>
|
||||
</a>
|
||||
@@ -37,11 +37,13 @@ $unique_hash = substr( md5( $args['form_id'] ), 10, 5 ); ?>
|
||||
|
||||
<div class="um-member-card <?php if ( ! $profile_photo ) { echo 'no-photo'; } ?>">
|
||||
<?php if ( $show_name ) { ?>
|
||||
<div class="um-member-name">
|
||||
<a href="{{{user.profile_url}}}" title="{{{user.display_name}}}">
|
||||
{{{user.display_name_html}}}
|
||||
</a>
|
||||
</div>
|
||||
<# if ( user.display_name_html ) { #>
|
||||
<div class="um-member-name">
|
||||
<a href="{{{user.profile_url}}}" title="{{{user.display_name}}}">
|
||||
{{{user.display_name_html}}}
|
||||
</a>
|
||||
</div>
|
||||
<# } #>
|
||||
<?php }
|
||||
|
||||
// please use for buttons priority > 100
|
||||
@@ -148,4 +150,4 @@ $unique_hash = substr( md5( $args['form_id'] ), 10, 5 ); ?>
|
||||
|
||||
<div class="um-clear"></div>
|
||||
</div>
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -15,7 +15,7 @@ $unique_hash = substr( md5( $args['form_id'] ), 10, 5 ); ?>
|
||||
<div class="um-member-card-container">
|
||||
<?php if ( $profile_photo ) { ?>
|
||||
<div class="um-member-photo radius-<?php echo esc_attr( UM()->options()->get( 'profile_photocorner' ) ); ?>">
|
||||
<a href="{{{user.profile_url}}}" title="{{{user.display_name}}}">
|
||||
<a href="{{{user.profile_url}}}" title="<# if ( user.display_name ) { #>{{{user.display_name}}}<# } #>">
|
||||
{{{user.avatar}}}
|
||||
|
||||
<?php do_action( 'um_members_list_in_profile_photo_tmpl', $args ); ?>
|
||||
@@ -27,11 +27,13 @@ $unique_hash = substr( md5( $args['form_id'] ), 10, 5 ); ?>
|
||||
<div class="um-member-card-content">
|
||||
<div class="um-member-card-header">
|
||||
<?php if ( $show_name ) { ?>
|
||||
<div class="um-member-name">
|
||||
<a href="{{{user.profile_url}}}" title="{{{user.display_name}}}">
|
||||
{{{user.display_name_html}}}
|
||||
</a>
|
||||
</div>
|
||||
<# if ( user.display_name_html ) { #>
|
||||
<div class="um-member-name">
|
||||
<a href="{{{user.profile_url}}}" title="<# if ( user.display_name ) { #>{{{user.display_name}}}<# } #>">
|
||||
{{{user.display_name_html}}}
|
||||
</a>
|
||||
</div>
|
||||
<# } #>
|
||||
<?php } ?>
|
||||
|
||||
{{{user.hook_just_after_name}}}
|
||||
@@ -148,4 +150,4 @@ $unique_hash = substr( md5( $args['form_id'] ), 10, 5 ); ?>
|
||||
<# } #>
|
||||
|
||||
</div>
|
||||
</script>
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user