mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-18 22:23:37 +09:00
- added escape functions, security fix for XSS;
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
<?php
|
||||
namespace um\core;
|
||||
|
||||
// Exit if accessed directly
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
|
||||
if ( ! class_exists( 'um\core\Account' ) ) {
|
||||
|
||||
|
||||
@@ -158,9 +159,9 @@ if ( ! class_exists( 'um\core\Account' ) ) {
|
||||
ob_start();
|
||||
|
||||
$defaults = array(
|
||||
'template' => 'account',
|
||||
'mode' => 'account',
|
||||
'form_id' => 'um_account_id',
|
||||
'template' => 'account',
|
||||
'mode' => 'account',
|
||||
'form_id' => 'um_account_id',
|
||||
);
|
||||
$args = wp_parse_args( $args, $defaults );
|
||||
|
||||
@@ -188,8 +189,9 @@ if ( ! class_exists( 'um\core\Account' ) ) {
|
||||
|
||||
if ( ! empty( $args['tab'] ) ) {
|
||||
|
||||
if ( $args['tab'] == 'account' )
|
||||
if ( $args['tab'] == 'account' ) {
|
||||
$args['tab'] = 'general';
|
||||
}
|
||||
|
||||
$this->init_tabs( $args );
|
||||
|
||||
@@ -219,7 +221,8 @@ if ( ! class_exists( 'um\core\Account' ) ) {
|
||||
* ?>
|
||||
*/
|
||||
do_action( 'um_account_page_hidden_fields', $args );
|
||||
$this->render_account_tab( $args['tab'], $this->tabs[$args['tab']], $args ); ?>
|
||||
|
||||
$this->render_account_tab( $args['tab'], $this->tabs[ $args['tab'] ], $args ); ?>
|
||||
</form>
|
||||
</div>
|
||||
<?php }
|
||||
@@ -269,7 +272,7 @@ if ( ! class_exists( 'um\core\Account' ) ) {
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
do_action( "um_before_form_is_loaded", $args );
|
||||
do_action( 'um_before_form_is_loaded', $args );
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
@@ -328,8 +331,8 @@ if ( ! class_exists( 'um\core\Account' ) ) {
|
||||
UM()->fields()->set_mode = 'account';
|
||||
UM()->fields()->editing = true;
|
||||
|
||||
if ( get_query_var('um_tab') ) {
|
||||
$this->current_tab = get_query_var('um_tab');
|
||||
if ( get_query_var( 'um_tab' ) ) {
|
||||
$this->current_tab = get_query_var( 'um_tab' );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -426,11 +429,11 @@ if ( ! class_exists( 'um\core\Account' ) ) {
|
||||
* @return array
|
||||
*/
|
||||
function predefined_fields_hook( $predefined_fields ) {
|
||||
|
||||
$account_hide_in_directory = UM()->options()->get( 'account_hide_in_directory' );
|
||||
|
||||
if ( ! $account_hide_in_directory )
|
||||
if ( ! $account_hide_in_directory ) {
|
||||
unset( $predefined_fields['hide_in_members'] );
|
||||
}
|
||||
|
||||
return $predefined_fields;
|
||||
}
|
||||
@@ -443,14 +446,14 @@ if ( ! class_exists( 'um\core\Account' ) ) {
|
||||
*/
|
||||
function tab_link( $id ) {
|
||||
|
||||
if ( get_option('permalink_structure') ) {
|
||||
if ( get_option( 'permalink_structure' ) ) {
|
||||
|
||||
$url = trailingslashit( untrailingslashit( um_get_core_page('account') ) );
|
||||
$url = trailingslashit( untrailingslashit( um_get_core_page( 'account' ) ) );
|
||||
$url = $url . $id . '/';
|
||||
|
||||
} else {
|
||||
|
||||
$url = add_query_arg( 'um_tab', $id, um_get_core_page('account') );
|
||||
$url = add_query_arg( 'um_tab', $id, um_get_core_page( 'account' ) );
|
||||
|
||||
}
|
||||
|
||||
@@ -465,8 +468,9 @@ if ( ! class_exists( 'um\core\Account' ) ) {
|
||||
*/
|
||||
function filter_fields_by_attrs( $fields, $shortcode_args ) {
|
||||
foreach ( $fields as $k => $field ) {
|
||||
if ( isset( $shortcode_args[ $field['metakey'] ] ) && 0 == $shortcode_args[ $field['metakey'] ] )
|
||||
if ( isset( $shortcode_args[ $field['metakey'] ] ) && 0 == $shortcode_args[ $field['metakey'] ] ) {
|
||||
unset( $fields[ $k ] );
|
||||
}
|
||||
}
|
||||
|
||||
return $fields;
|
||||
@@ -474,10 +478,10 @@ if ( ! class_exists( 'um\core\Account' ) ) {
|
||||
|
||||
|
||||
/**
|
||||
* @param $fields
|
||||
* @param array $fields
|
||||
* @param $id
|
||||
*
|
||||
* @return mixed|void
|
||||
* @return array
|
||||
*/
|
||||
function account_secure_fields( $fields, $id ) {
|
||||
/**
|
||||
@@ -507,11 +511,13 @@ if ( ! class_exists( 'um\core\Account' ) ) {
|
||||
|
||||
|
||||
/**
|
||||
* * Get Tab Output
|
||||
* Get Tab Output
|
||||
*
|
||||
* @param integer $id
|
||||
* @param array $shortcode_args
|
||||
* @return mixed|null|string|void
|
||||
* @param $id
|
||||
* @param $shortcode_args
|
||||
*
|
||||
* @return mixed|string|null
|
||||
* @throws \Exception
|
||||
*/
|
||||
function get_tab_fields( $id, $shortcode_args ) {
|
||||
$output = null;
|
||||
@@ -521,7 +527,7 @@ if ( ! class_exists( 'um\core\Account' ) ) {
|
||||
|
||||
if ( ! empty( $this->tab_output[$id]['content'] ) && ! empty( $this->tab_output[$id]['hash'] ) &&
|
||||
$this->tab_output[$id]['hash'] == md5( json_encode( $shortcode_args ) ) ) {
|
||||
return $this->tab_output[$id]['content'];
|
||||
return $this->tab_output[ $id ]['content'];
|
||||
}
|
||||
|
||||
switch ( $id ) {
|
||||
@@ -712,7 +718,7 @@ if ( ! class_exists( 'um\core\Account' ) ) {
|
||||
|
||||
}
|
||||
|
||||
$this->tab_output[$id] = array( 'content' => $output, 'hash' => md5( json_encode( $shortcode_args ) ) );
|
||||
$this->tab_output[ $id ] = array( 'content' => $output, 'hash' => md5( json_encode( $shortcode_args ) ) );
|
||||
return $output;
|
||||
}
|
||||
|
||||
@@ -723,6 +729,8 @@ if ( ! class_exists( 'um\core\Account' ) ) {
|
||||
* @param $tab_id
|
||||
* @param $tab_data
|
||||
* @param $args
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
function render_account_tab( $tab_id, $tab_data, $args ) {
|
||||
|
||||
@@ -732,7 +740,7 @@ if ( ! class_exists( 'um\core\Account' ) ) {
|
||||
|
||||
if ( ! empty ( $tab_data['with_header'] ) ) { ?>
|
||||
|
||||
<div class="um-account-heading uimob340-hide uimob500-hide"><i class="<?php echo $tab_data['icon'] ?>"></i><?php echo $tab_data['title']; ?></div>
|
||||
<div class="um-account-heading uimob340-hide uimob500-hide"><i class="<?php echo esc_attr( $tab_data['icon'] ) ?>"></i><?php echo esc_html( $tab_data['title'] ); ?></div>
|
||||
|
||||
<?php }
|
||||
|
||||
@@ -786,7 +794,7 @@ if ( ! class_exists( 'um\core\Account' ) ) {
|
||||
<div class="um-left">
|
||||
<?php $submit_title = ! empty( $tab_data['submit_title'] ) ? $tab_data['submit_title'] : $tab_data['title']; ?>
|
||||
<input type="hidden" name="um_account_nonce_<?php echo esc_attr( $tab_id ) ?>" value="<?php echo esc_attr( wp_create_nonce( 'um_update_account_' . $tab_id ) ) ?>" />
|
||||
<input type="submit" name="um_account_submit" id="um_account_submit_<?php echo $tab_id ?>" class="um-button" value="<?php echo esc_attr( $submit_title ) ?>" />
|
||||
<input type="submit" name="um_account_submit" id="um_account_submit_<?php echo esc_attr( $tab_id ) ?>" class="um-button" value="<?php echo esc_attr( $submit_title ) ?>" />
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
@@ -1,156 +0,0 @@
|
||||
<?php
|
||||
namespace um\core;
|
||||
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
if ( ! class_exists( 'um\core\Chart' ) ) {
|
||||
|
||||
|
||||
/**
|
||||
* Class Chart
|
||||
* @package um\core
|
||||
*/
|
||||
class Chart {
|
||||
|
||||
|
||||
/**
|
||||
* Chart constructor.
|
||||
*/
|
||||
function __construct() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a new chart
|
||||
*
|
||||
* @param array $args
|
||||
*/
|
||||
function create( $args = array() ) {
|
||||
|
||||
$defaults = array(
|
||||
'id' => 0,
|
||||
'type' => 'LineChart',
|
||||
'data' => null,
|
||||
'x_label' => null,
|
||||
'y_label' => null,
|
||||
'vertical_max_lines' => 6,
|
||||
'colors' => '#0085ba',
|
||||
'backgroundcolor' => 'transparent',
|
||||
'basetextcolor' => '#666',
|
||||
'basebordercolor' => '#bbb',
|
||||
'days' => 30
|
||||
);
|
||||
|
||||
$args = wp_parse_args( $args, $defaults );
|
||||
|
||||
|
||||
/**
|
||||
* @var $type
|
||||
*/
|
||||
extract( $args );
|
||||
|
||||
if ( $type == 'LineChart' ) {
|
||||
$this->linechart( $args );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* LineChart
|
||||
*
|
||||
* @param $args
|
||||
*/
|
||||
function linechart( $args ) {
|
||||
/**
|
||||
* @var $x_label
|
||||
* @var $y_label
|
||||
* @var $vertical_max_lines
|
||||
* @var $backgroundcolor
|
||||
* @var $colors
|
||||
* @var $basebordercolor
|
||||
* @var $basetextcolor
|
||||
* @var $data
|
||||
* @var $id
|
||||
*/
|
||||
extract( $args ); ?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
google.load( "visualization", "1", {packages:["corechart"]});
|
||||
|
||||
function draw_linechart() {
|
||||
|
||||
var data = new google.visualization.DataTable();
|
||||
data.addColumn('string', '<?php echo $x_label; ?>');
|
||||
data.addColumn('number', '<?php echo $y_label; ?>');
|
||||
|
||||
<?php /*if ( ! empty( $data_y ) ) {
|
||||
|
||||
foreach ( $data_y as $key => $val ) {
|
||||
|
||||
}
|
||||
|
||||
}*/ ?>
|
||||
|
||||
var min_data = 0;
|
||||
var max_data = data.getColumnRange(1).max;
|
||||
|
||||
var vgrid_count = <?php echo $vertical_max_lines; ?>;
|
||||
var hgrid_count = Math.floor( data.getNumberOfRows() / 4 );
|
||||
|
||||
/* Options */
|
||||
var options = {
|
||||
backgroundColor: '<?php echo $backgroundcolor; ?>',
|
||||
colors: ['<?php echo $colors; ?>'],
|
||||
curveType: 'function',
|
||||
pointSize: 8,
|
||||
lineWidth: 4,
|
||||
vAxis:{
|
||||
baselineColor: '<?php echo $basebordercolor; ?>',
|
||||
gridlineColor: '<?php echo $basebordercolor; ?>',
|
||||
gridlines: {color: 'transparent', count: vgrid_count},
|
||||
textStyle: {color: '<?php echo $basetextcolor; ?>', fontSize: 12 },
|
||||
format: '#',
|
||||
viewWindow: {min: min_data, max: max_data + 10}
|
||||
},
|
||||
hAxis:{
|
||||
textStyle: {color: '<?php echo $basetextcolor; ?>', fontSize: 12, italic: true },
|
||||
showTextEvery: hgrid_count,
|
||||
maxAlternation: 1,
|
||||
maxTextLines: 1
|
||||
},
|
||||
legend: {
|
||||
position: 'top',
|
||||
alignment: 'start',
|
||||
textStyle: {color: '<?php echo $basetextcolor; ?>', fontSize: 13}
|
||||
},
|
||||
tooltip: {
|
||||
textStyle: {color: '<?php echo $basetextcolor; ?>', fontSize: 12}
|
||||
},
|
||||
chartArea: {
|
||||
top:50,left:30,width: '95%', 'height' : ( vgrid_count * 50 ) - 100,
|
||||
backgroundColor: {
|
||||
stroke: '<?php echo $basebordercolor; ?>',
|
||||
strokeWidth: 1
|
||||
}
|
||||
},
|
||||
width: '100%',
|
||||
height: ( vgrid_count * 50 )
|
||||
};
|
||||
|
||||
var chart = new google.visualization.LineChart( document.getElementById( 'chart_<?php echo $data . $id; ?>' ) );
|
||||
chart.draw( data, options );
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div id="chart_<?php echo $data . $id; ?>"></div>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+578
-423
File diff suppressed because it is too large
Load Diff
@@ -4,6 +4,7 @@ namespace um\core;
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
|
||||
if ( ! class_exists( 'um\core\Members' ) ) {
|
||||
|
||||
|
||||
@@ -26,8 +27,7 @@ if ( ! class_exists( 'um\core\Members' ) ) {
|
||||
function __construct() {
|
||||
|
||||
add_filter( 'user_search_columns', array( &$this, 'user_search_columns' ), 99 );
|
||||
|
||||
add_action( 'template_redirect', array( &$this, 'access_members' ), 555);
|
||||
add_action( 'template_redirect', array( &$this, 'access_members' ), 555 );
|
||||
|
||||
$this->core_search_fields = array(
|
||||
'user_login',
|
||||
@@ -36,7 +36,7 @@ if ( ! class_exists( 'um\core\Members' ) ) {
|
||||
'user_email',
|
||||
);
|
||||
|
||||
add_filter( 'um_search_select_fields', array(&$this, 'um_search_select_fields'), 10, 1 );
|
||||
add_filter( 'um_search_select_fields', array( &$this, 'um_search_select_fields' ), 10, 1 );
|
||||
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ if ( ! class_exists( 'um\core\Members' ) ) {
|
||||
* Members page allowed?
|
||||
*/
|
||||
function access_members() {
|
||||
if ( UM()->options()->get('members_page') == 0 && um_is_core_page( 'members' ) ) {
|
||||
if ( UM()->options()->get( 'members_page' ) == 0 && um_is_core_page( 'members' ) ) {
|
||||
um_redirect_home();
|
||||
}
|
||||
}
|
||||
@@ -84,7 +84,7 @@ if ( ! class_exists( 'um\core\Members' ) ) {
|
||||
$array['total_users'],
|
||||
);
|
||||
|
||||
$string = str_replace($search, $replace, $string);
|
||||
$string = str_replace( $search, $replace, $string );
|
||||
return $string;
|
||||
}
|
||||
|
||||
@@ -253,7 +253,8 @@ if ( ! class_exists( 'um\core\Members' ) ) {
|
||||
$label = isset( $attrs['title'] ) ? $attrs['title'] : '';
|
||||
} ?>
|
||||
|
||||
<select name="<?php echo $filter; ?>" id="<?php echo $filter; ?>" class="um-s1" style="width: 100%" data-placeholder="<?php echo __( stripslashes( $label ), 'ultimate-member' ); ?>" <?php if ( ! empty( $attrs['custom_dropdown_options_source'] ) ) { ?> data-um-parent="<?php echo $attrs['parent_dropdown_relationship']; ?>" data-mebers-directory="yes" data-um-ajax-source="<?php echo $attrs['custom_dropdown_options_source'] ?>"<?php } ?>>
|
||||
<select name="<?php echo esc_attr( $filter ); ?>" id="<?php echo esc_attr( $filter ); ?>" class="um-s1"
|
||||
style="width: 100%" data-placeholder="<?php esc_attr_e( stripslashes( $label ), 'ultimate-member' ); ?>" <?php if ( ! empty( $attrs['custom_dropdown_options_source'] ) ) { ?> data-um-parent="<?php echo esc_attr( $attrs['parent_dropdown_relationship'] ); ?>" data-mebers-directory="yes" data-um-ajax-source="<?php echo esc_attr( $attrs['custom_dropdown_options_source'] ) ?>"<?php } ?>>
|
||||
|
||||
<option></option>
|
||||
|
||||
@@ -263,33 +264,32 @@ if ( ! class_exists( 'um\core\Members' ) ) {
|
||||
|
||||
$opt = $v;
|
||||
|
||||
if ( strstr( $filter, 'role_' ) )
|
||||
if ( strstr( $filter, 'role_' ) ) {
|
||||
$opt = $k;
|
||||
}
|
||||
|
||||
if ( isset( $attrs['custom'] ) )
|
||||
if ( isset( $attrs['custom'] ) ) {
|
||||
$opt = $k;
|
||||
} ?>
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<option value="<?php echo $opt; ?>" <?php um_select_if_in_query_params( $filter, $opt ); ?> <?php selected( isset( $_GET[$filter] ) && $_GET[$filter] == $v ) ?>><?php echo __( $v, 'ultimate-member'); ?></option>
|
||||
<option value="<?php echo esc_attr( $opt ); ?>" <?php um_select_if_in_query_params( $filter, $opt ); ?> <?php selected( isset( $_GET[ $filter ] ) && $_GET[ $filter ] == $v ) ?>><?php esc_html_e( $v, 'ultimate-member'); ?></option>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</select>
|
||||
</select>
|
||||
|
||||
<?php
|
||||
|
||||
break;
|
||||
|
||||
case 'text':
|
||||
|
||||
?>
|
||||
|
||||
<input type="text" autocomplete="off" name="<?php echo $filter; ?>" id="<?php echo $filter; ?>" placeholder="<?php echo isset( $attrs['label'] ) ? __( $attrs['label'], 'ultimate-member') : ''; ?>" value='<?php echo esc_attr( um_queried_search_value( $filter, false ) ); ?>' />
|
||||
<input type="text" autocomplete="off" name="<?php echo esc_attr( $filter ); ?>" id="<?php echo esc_attr( $filter ); ?>"
|
||||
placeholder="<?php echo isset( $attrs['label'] ) ? esc_attr__( $attrs['label'], 'ultimate-member' ) : ''; ?>"
|
||||
value="<?php echo esc_attr( um_queried_search_value( $filter, false ) ); ?>" />
|
||||
|
||||
<?php
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
@@ -306,12 +306,12 @@ if ( ! class_exists( 'um\core\Members' ) ) {
|
||||
*/
|
||||
function um_search_select_fields( $attrs ) {
|
||||
|
||||
if( !empty($attrs['metakey']) && strstr( $attrs['metakey'], 'role_' ) ){
|
||||
if ( ! empty( $attrs['metakey'] ) && strstr( $attrs['metakey'], 'role_' ) ) {
|
||||
|
||||
$shortcode_roles = get_post_meta( UM()->shortcodes()->form_id, '_um_roles', true );
|
||||
$um_roles = UM()->roles()->get_roles( false );
|
||||
|
||||
if( ! empty( $shortcode_roles ) && is_array( $shortcode_roles ) ){
|
||||
if ( ! empty( $shortcode_roles ) && is_array( $shortcode_roles ) ) {
|
||||
|
||||
$attrs['options'] = array();
|
||||
|
||||
@@ -371,22 +371,22 @@ if ( ! class_exists( 'um\core\Members' ) ) {
|
||||
$query_args = apply_filters( 'um_prepare_user_query_args', array(), $args );
|
||||
|
||||
// Prepare for BIG SELECT query
|
||||
$wpdb->query('SET SQL_BIG_SELECTS=1');
|
||||
$wpdb->query( 'SET SQL_BIG_SELECTS=1' );
|
||||
|
||||
// number of profiles for mobile
|
||||
if ( UM()->mobile()->isMobile() && isset( $profiles_per_page_mobile ) ){
|
||||
if ( UM()->mobile()->isMobile() && isset( $profiles_per_page_mobile ) ) {
|
||||
$profiles_per_page = $profiles_per_page_mobile;
|
||||
}
|
||||
|
||||
$query_args['number'] = $profiles_per_page;
|
||||
|
||||
if( isset( $args['number'] ) ){
|
||||
if ( isset( $args['number'] ) ) {
|
||||
$query_args['number'] = $args['number'];
|
||||
}
|
||||
|
||||
if( isset( $args['page'] ) ){
|
||||
if ( isset( $args['page'] ) ) {
|
||||
$members_page = $args['page'];
|
||||
}else{
|
||||
} else {
|
||||
$members_page = isset( $_REQUEST['members_page'] ) ? $_REQUEST['members_page'] : 1;
|
||||
}
|
||||
|
||||
@@ -478,18 +478,18 @@ if ( ! class_exists( 'um\core\Members' ) ) {
|
||||
if ( isset( $pages_to_add ) ) {
|
||||
|
||||
asort( $pages_to_add );
|
||||
$pages_to_show = array_merge( (array)$pages_to_add, $pages_to_show );
|
||||
$pages_to_show = array_merge( (array) $pages_to_add, $pages_to_show );
|
||||
|
||||
if ( count( $pages_to_show ) < 5 ) {
|
||||
if ( max($pages_to_show) - $array['page'] >= 2 ) {
|
||||
$pages_to_show[] = max($pages_to_show) + 1;
|
||||
if ( max( $pages_to_show ) - $array['page'] >= 2 ) {
|
||||
$pages_to_show[] = max( $pages_to_show ) + 1;
|
||||
if ( count( $pages_to_show ) < 5 ) {
|
||||
$pages_to_show[] = max($pages_to_show) + 1;
|
||||
$pages_to_show[] = max( $pages_to_show ) + 1;
|
||||
}
|
||||
} else if ( $array['page'] - min($pages_to_show) >= 2 ) {
|
||||
$pages_to_show[] = min($pages_to_show) - 1;
|
||||
} else if ( $array['page'] - min( $pages_to_show ) >= 2 ) {
|
||||
$pages_to_show[] = min( $pages_to_show ) - 1;
|
||||
if ( count( $pages_to_show ) < 5 ) {
|
||||
$pages_to_show[] = min($pages_to_show) - 1;
|
||||
$pages_to_show[] = min( $pages_to_show ) - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -528,7 +528,7 @@ if ( ! class_exists( 'um\core\Members' ) ) {
|
||||
|
||||
if ( $array['total_pages'] < count( $array['pages_to_show'] ) ) {
|
||||
foreach ( $array['pages_to_show'] as $k => $v ) {
|
||||
if ( $v > $array['total_pages'] ) unset( $array['pages_to_show'][$k] );
|
||||
if ( $v > $array['total_pages'] ) unset( $array['pages_to_show'][ $k ] );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -576,13 +576,13 @@ if ( ! class_exists( 'um\core\Members' ) ) {
|
||||
|
||||
$arr_where = explode("\n", $vars->query_where );
|
||||
$arr_left_join = explode("LEFT JOIN", $vars->query_from );
|
||||
$arr_user_photo_key = array('synced_profile_photo','profile_photo','synced_gravatar_hashed_id');
|
||||
$arr_user_photo_key = array( 'synced_profile_photo', 'profile_photo', 'synced_gravatar_hashed_id' );
|
||||
|
||||
foreach ( $arr_where as $where ) {
|
||||
|
||||
foreach( $arr_user_photo_key as $key ){
|
||||
foreach ( $arr_user_photo_key as $key ) {
|
||||
|
||||
if( strpos( $where , "'".$key."'" ) > -1 ){
|
||||
if ( strpos( $where, "'" . $key . "'" ) > -1 ) {
|
||||
|
||||
// find usermeta key
|
||||
preg_match("#mt[0-9]+.#", $where, $meta_key );
|
||||
@@ -597,9 +597,9 @@ if ( ! class_exists( 'um\core\Members' ) ) {
|
||||
$where_exists = 'um_exist EXISTS( SELECT '.$wpdb->usermeta.'.umeta_id FROM '.$wpdb->usermeta.' WHERE '.$wpdb->usermeta.'.user_id = '.$wpdb->users.'.ID AND '.$wpdb->usermeta.'.meta_key IN("'.implode('","', $arr_user_photo_key ).'") AND '.$wpdb->usermeta.'.meta_value != "" )';
|
||||
|
||||
// Replace LEFT JOIN clauses with EXISTS and remove duplicates
|
||||
if( strpos( $vars->query_where, 'um_exist' ) === FALSE ){
|
||||
if ( strpos( $vars->query_where, 'um_exist' ) === FALSE ) {
|
||||
$vars->query_where = str_replace( $where , $where_exists, $vars->query_where );
|
||||
}else{
|
||||
} else {
|
||||
$vars->query_where = str_replace( $where , '1=0', $vars->query_where );
|
||||
}
|
||||
}
|
||||
@@ -608,8 +608,8 @@ if ( ! class_exists( 'um\core\Members' ) ) {
|
||||
|
||||
}
|
||||
|
||||
$vars->query_where = str_replace("\n", "", $vars->query_where );
|
||||
$vars->query_where = str_replace("um_exist", "", $vars->query_where );
|
||||
$vars->query_where = str_replace( "\n", "", $vars->query_where );
|
||||
$vars->query_where = str_replace( "um_exist", "", $vars->query_where );
|
||||
|
||||
return $vars;
|
||||
|
||||
|
||||
@@ -52,8 +52,9 @@ if ( ! class_exists( 'um\core\Profile' ) ) {
|
||||
*/
|
||||
extract( $_REQUEST );
|
||||
|
||||
if ( ! UM()->roles()->um_current_user_can( 'edit', $user_id ) )
|
||||
if ( ! UM()->roles()->um_current_user_can( 'edit', $user_id ) ) {
|
||||
die( __( 'You can not edit this user' ) );
|
||||
}
|
||||
|
||||
UM()->files()->delete_core_user_photo( $user_id, 'profile_photo' );
|
||||
}
|
||||
@@ -70,8 +71,9 @@ if ( ! class_exists( 'um\core\Profile' ) ) {
|
||||
*/
|
||||
extract( $_REQUEST );
|
||||
|
||||
if ( ! UM()->roles()->um_current_user_can( 'edit', $user_id ) )
|
||||
if ( ! UM()->roles()->um_current_user_can( 'edit', $user_id ) ) {
|
||||
die( __( 'You can not edit this user' ) );
|
||||
}
|
||||
|
||||
UM()->files()->delete_core_user_photo( $user_id, 'cover_photo' );
|
||||
}
|
||||
@@ -355,8 +357,8 @@ if ( ! class_exists( 'um\core\Profile' ) ) {
|
||||
|
||||
$this->active_subnav = null;
|
||||
|
||||
if ( get_query_var('subnav') ) {
|
||||
$this->active_subnav = get_query_var('subnav');
|
||||
if ( get_query_var( 'subnav' ) ) {
|
||||
$this->active_subnav = get_query_var( 'subnav' );
|
||||
}
|
||||
|
||||
return $this->active_subnav;
|
||||
@@ -420,7 +422,7 @@ if ( ! class_exists( 'um\core\Profile' ) ) {
|
||||
function new_ui( $position, $element, $trigger, $items ) {
|
||||
?>
|
||||
|
||||
<div class="um-dropdown" data-element="<?php echo $element; ?>" data-position="<?php echo $position; ?>" data-trigger="<?php echo $trigger; ?>">
|
||||
<div class="um-dropdown" data-element="<?php echo esc_attr( $element ); ?>" data-position="<?php echo esc_attr( $position ); ?>" data-trigger="<?php echo esc_attr( $trigger ); ?>">
|
||||
<div class="um-dropdown-b">
|
||||
<div class="um-dropdown-arr"><i class=""></i></div>
|
||||
<ul>
|
||||
|
||||
@@ -337,7 +337,7 @@ if ( ! class_exists( 'um\core\Uploader' ) ) {
|
||||
$allowed_image_mimes[ $atype['ext'] ] = $atype['type'];
|
||||
}
|
||||
|
||||
$image_compression = UM()->options()->get('image_compression');
|
||||
$image_compression = UM()->options()->get( 'image_compression' );
|
||||
|
||||
$upload_overrides = array(
|
||||
'test_form' => false,
|
||||
|
||||
@@ -53,18 +53,18 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
$this->target_id = null;
|
||||
|
||||
// When the cache should be cleared
|
||||
add_action('um_delete_user_hook', array(&$this, 'remove_cached_queue') );
|
||||
add_action('um_delete_user', array( &$this, 'remove_cache' ), 10, 1 );
|
||||
add_action( 'um_delete_user_hook', array( &$this, 'remove_cached_queue' ) );
|
||||
add_action( 'um_delete_user', array( &$this, 'remove_cache' ), 10, 1 );
|
||||
|
||||
add_action('um_after_user_status_is_changed_hook', array(&$this, 'remove_cached_queue') );
|
||||
add_action( 'um_after_user_status_is_changed_hook', array( &$this, 'remove_cached_queue' ) );
|
||||
|
||||
// When user cache should be cleared
|
||||
add_action('um_after_user_updated', array(&$this, 'remove_cache') );
|
||||
add_action('um_after_user_account_updated', array(&$this, 'remove_cache') );
|
||||
add_action('personal_options_update', array(&$this, 'remove_cache') );
|
||||
add_action( 'um_after_user_updated', array( &$this, 'remove_cache' ) );
|
||||
add_action( 'um_after_user_account_updated', array( &$this, 'remove_cache' ) );
|
||||
add_action( 'personal_options_update', array( &$this, 'remove_cache' ) );
|
||||
//add_action('edit_user_profile_update', array(&$this, 'remove_cache') );
|
||||
add_action('um_when_role_is_set', array(&$this, 'remove_cache') );
|
||||
add_action('um_when_status_is_set', array(&$this, 'remove_cache') );
|
||||
add_action( 'um_when_role_is_set', array( &$this, 'remove_cache' ) );
|
||||
add_action( 'um_when_status_is_set', array( &$this, 'remove_cache' ) );
|
||||
|
||||
add_action( 'show_user_profile', array( $this, 'profile_form_additional_section' ), 10 );
|
||||
add_action( 'user_new_form', array( $this, 'profile_form_additional_section' ), 10 );
|
||||
@@ -164,8 +164,9 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
*
|
||||
*/
|
||||
function check_membership() {
|
||||
if ( ! is_user_logged_in() )
|
||||
if ( ! is_user_logged_in() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
um_fetch_user( get_current_user_id() );
|
||||
$status = um_user( 'account_status' );
|
||||
@@ -209,8 +210,9 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
*/
|
||||
function add_um_role_wpmu_new_user( $user_id ) {
|
||||
// Bail if no user ID was passed
|
||||
if ( empty( $user_id ) )
|
||||
if ( empty( $user_id ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! empty( $_POST['um-role'] ) ) {
|
||||
if ( ! user_can( $user_id, $_POST['um-role'] ) ) {
|
||||
@@ -289,7 +291,7 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
//get default username permalink if it's empty then return false
|
||||
if ( empty( $profile_slug ) ) {
|
||||
if ( $permalink_base != 'user_login' ) {
|
||||
$profile_slug = get_user_meta( $user_id, "um_user_profile_url_slug_user_login", true );
|
||||
$profile_slug = get_user_meta( $user_id, 'um_user_profile_url_slug_user_login', true );
|
||||
}
|
||||
|
||||
if ( empty( $profile_slug ) ) {
|
||||
@@ -581,29 +583,32 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
$role_meta = get_option( "um_role_{$role_key}_meta" );
|
||||
|
||||
if ( $role_meta ) {
|
||||
//$role_meta['name'] = 'UM ' . $role_meta['name'];
|
||||
$roles['um_' . $role_key] = $role_meta;
|
||||
$roles[ 'um_' . $role_key ] = $role_meta;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( empty( $roles ) )
|
||||
if ( empty( $roles ) ) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
global $pagenow;
|
||||
if ( 'profile.php' == $pagenow )
|
||||
if ( 'profile.php' == $pagenow ) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
$style = '';
|
||||
$user_role = false;
|
||||
if ( $userdata !== 'add-new-user' && $userdata !== 'add-existing-user' ) {
|
||||
// Bail if current user cannot edit users
|
||||
if ( ! current_user_can( 'edit_user', $userdata->ID ) )
|
||||
if ( ! current_user_can( 'edit_user', $userdata->ID ) ) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
$user_role = UM()->roles()->get_um_user_role( $userdata->ID );
|
||||
if ( $user_role && ! empty( $userdata->roles ) && count( $userdata->roles ) == 1 )
|
||||
if ( $user_role && ! empty( $userdata->roles ) && count( $userdata->roles ) == 1 ) {
|
||||
$style = 'style="display:none;"';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -611,7 +616,7 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
|
||||
ob_start(); ?>
|
||||
|
||||
<div id="<?php echo $class ?>" <?php echo $style ?>>
|
||||
<div id="<?php echo esc_attr( $class ) ?>" <?php echo $style ?>>
|
||||
<table class="form-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
@@ -620,7 +625,7 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
<select name="um-role" id="um-role">
|
||||
<option value="" <?php selected( empty( $user_role ) ) ?>><?php esc_html_e( '— No role for Ultimate Member —', 'ultimate-member' ); ?></option>
|
||||
<?php foreach ( $roles as $role_id => $details ) { ?>
|
||||
<option <?php selected( $user_role, $role_id ); ?> value="<?php echo esc_attr( $role_id ); ?>"><?php echo $details['name']; ?></option>
|
||||
<option <?php selected( $user_role, $role_id ); ?> value="<?php echo esc_attr( $role_id ); ?>"><?php echo esc_html( $details['name'] ); ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</td>
|
||||
@@ -651,7 +656,9 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
* @return array
|
||||
*/
|
||||
function toArray( $obj ) {
|
||||
if ( is_object( $obj ) ) $obj = (array)$obj;
|
||||
if ( is_object( $obj ) ) {
|
||||
$obj = (array) $obj;
|
||||
}
|
||||
if ( is_array( $obj ) ) {
|
||||
$new = array();
|
||||
foreach ( $obj as $key => $val ) {
|
||||
@@ -668,17 +675,17 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
/**
|
||||
* @param $user_id
|
||||
*
|
||||
* @return mixed|string|void
|
||||
* @return mixed|string
|
||||
*/
|
||||
function get_cached_data( $user_id ) {
|
||||
|
||||
$disallow_cache = UM()->options()->get( 'um_profile_object_cache_stop' );
|
||||
if( $disallow_cache ){
|
||||
if ( $disallow_cache ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ( is_numeric( $user_id ) && $user_id > 0 ) {
|
||||
$find_user = get_option("um_cache_userdata_{$user_id}");
|
||||
$find_user = get_option( "um_cache_userdata_{$user_id}" );
|
||||
if ( $find_user ) {
|
||||
/**
|
||||
* UM hook
|
||||
@@ -916,10 +923,11 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
* Clean user profile
|
||||
*/
|
||||
function clean() {
|
||||
foreach($this->profile as $key => $value){
|
||||
foreach($this->banned_keys as $ban){
|
||||
if (strstr($key, $ban) || is_numeric($key) )
|
||||
unset($this->profile[$key]);
|
||||
foreach ( $this->profile as $key => $value ) {
|
||||
foreach ( $this->banned_keys as $ban ) {
|
||||
if ( strstr( $key, $ban ) || is_numeric( $key ) ) {
|
||||
unset( $this->profile[ $key ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -949,7 +957,7 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
|
||||
wp_set_auth_cookie( $user_id, $rememberme );
|
||||
|
||||
$user = get_user_by('ID', $user_id );
|
||||
$user = get_user_by( 'ID', $user_id );
|
||||
|
||||
do_action( 'wp_login', $user->user_login, $user );
|
||||
|
||||
@@ -1197,21 +1205,21 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
* Password reset email
|
||||
*/
|
||||
function password_reset() {
|
||||
$userdata = get_userdata( um_user('ID') );
|
||||
$userdata = get_userdata( um_user( 'ID' ) );
|
||||
get_password_reset_key( $userdata );
|
||||
|
||||
add_filter( 'um_template_tags_patterns_hook', array( UM()->password(), 'add_placeholder' ), 10, 1 );
|
||||
add_filter( 'um_template_tags_replaces_hook', array( UM()->password(), 'add_replace_placeholder' ), 10, 1 );
|
||||
|
||||
UM()->mail()->send( um_user('user_email'), 'resetpw_email' );
|
||||
UM()->mail()->send( um_user( 'user_email' ), 'resetpw_email' );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Password changed email
|
||||
*/
|
||||
function password_changed(){
|
||||
UM()->mail()->send( um_user('user_email'), 'changedpw_email' );
|
||||
function password_changed() {
|
||||
UM()->mail()->send( um_user( 'user_email' ), 'changedpw_email' );
|
||||
}
|
||||
|
||||
|
||||
@@ -1242,19 +1250,19 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
|
||||
delete_option( "um_cache_userdata_{$user_id}" );
|
||||
|
||||
if ( um_user('account_status') == 'awaiting_admin_review' ) {
|
||||
if ( um_user( 'account_status' ) == 'awaiting_admin_review' ) {
|
||||
$userdata = get_userdata( $user_id );
|
||||
get_password_reset_key( $userdata );
|
||||
UM()->mail()->send( um_user('user_email'), 'approved_email' );
|
||||
UM()->mail()->send( um_user( 'user_email' ), 'approved_email' );
|
||||
|
||||
} else {
|
||||
$userdata = get_userdata( $user_id );
|
||||
get_password_reset_key( $userdata );
|
||||
UM()->mail()->send( um_user('user_email'), 'welcome_email');
|
||||
UM()->mail()->send( um_user( 'user_email' ), 'welcome_email' );
|
||||
}
|
||||
|
||||
$this->set_status('approved');
|
||||
$this->delete_meta('account_secret_hash');
|
||||
$this->set_status( 'approved' );
|
||||
$this->delete_meta( 'account_secret_hash' );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
@@ -1284,8 +1292,8 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
*/
|
||||
function email_pending() {
|
||||
$this->assign_secretkey();
|
||||
$this->set_status('awaiting_email_confirmation');
|
||||
UM()->mail()->send( um_user('user_email'), 'checkmail_email' );
|
||||
$this->set_status( 'awaiting_email_confirmation' );
|
||||
UM()->mail()->send( um_user( 'user_email' ), 'checkmail_email' );
|
||||
}
|
||||
|
||||
|
||||
@@ -1327,8 +1335,8 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
*
|
||||
*/
|
||||
function reject() {
|
||||
$this->set_status('rejected');
|
||||
UM()->mail()->send( um_user('user_email'), 'rejected_email' );
|
||||
$this->set_status( 'rejected' );
|
||||
UM()->mail()->send( um_user( 'user_email' ), 'rejected_email' );
|
||||
}
|
||||
|
||||
|
||||
@@ -1452,7 +1460,7 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
function update_usermeta_info( $key ) {
|
||||
// delete the key first just in case
|
||||
delete_user_meta( $this->id, $key );
|
||||
update_user_meta( $this->id, $key, $this->profile[$key] );
|
||||
update_user_meta( $this->id, $key, $this->profile[ $key ] );
|
||||
}
|
||||
|
||||
|
||||
@@ -1474,7 +1482,7 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
|
||||
*
|
||||
*/
|
||||
function delete_meta( $key ){
|
||||
function delete_meta( $key ) {
|
||||
delete_user_meta( $this->id, $key );
|
||||
}
|
||||
|
||||
@@ -1518,7 +1526,7 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
$url = add_query_arg( array( 'um_action' => $id, 'uid' => um_profile_id() ) );
|
||||
/*$url = add_query_arg( 'um_action', $id );
|
||||
$url = add_query_arg( 'uid', um_profile_id(), $url );*/
|
||||
$items[] = '<a href="' . $url .'" class="real_url ' . esc_attr( $id ) . '-item">' . $arr['label'] . '</a>';
|
||||
$items[] = '<a href="' . esc_url( $url ) .'" class="real_url ' . esc_attr( $id ) . '-item">' . esc_html( $arr['label'] ) . '</a>';
|
||||
}
|
||||
return $items;
|
||||
}
|
||||
@@ -1548,7 +1556,7 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
*/
|
||||
function is_private_profile( $user_id ) {
|
||||
$privacy = get_user_meta( $user_id, 'profile_privacy', true );
|
||||
if ( $privacy == __('Only me','ultimate-member') || $privacy == 'Only me' ) {
|
||||
if ( $privacy == __( 'Only me', 'ultimate-member' ) || $privacy == 'Only me' ) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -1730,17 +1738,24 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
|
||||
$value = UM()->validation()->safe_name_in_url( $value );
|
||||
|
||||
$ids = get_users(array( 'fields' => 'ID', 'meta_key' => $key,'meta_value' => $value,'meta_compare' => '=') );
|
||||
if ( !isset( $ids ) || empty( $ids ) ) return false;
|
||||
foreach( $ids as $k => $id ) {
|
||||
if ( $id == um_user('ID') ){
|
||||
unset( $ids[$k] );
|
||||
$ids = get_users( array( 'fields' => 'ID', 'meta_key' => $key, 'meta_value' => $value, 'meta_compare' => '=' ) );
|
||||
if ( ! isset( $ids ) || empty( $ids ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ( $ids as $k => $id ) {
|
||||
|
||||
if ( $id == um_user('ID') ) {
|
||||
unset( $ids[ $k ] );
|
||||
} else {
|
||||
$duplicates[] = $id;
|
||||
}
|
||||
|
||||
}
|
||||
if ( isset( $duplicates ) && !empty( $duplicates ) )
|
||||
|
||||
if ( ! empty( $duplicates ) ) {
|
||||
return count( $duplicates );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1763,57 +1778,55 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
|
||||
// Search by Profile Slug
|
||||
$args = array(
|
||||
"fields" => array("ID"),
|
||||
'fields' => array( 'ID' ),
|
||||
'meta_query' => array(
|
||||
'relation' => 'OR',
|
||||
array(
|
||||
'key' => 'um_user_profile_url_slug_'.$permalink_base,
|
||||
'value' => strtolower( $raw_value ),
|
||||
'compare' => '='
|
||||
|
||||
)
|
||||
|
||||
)
|
||||
'key' => 'um_user_profile_url_slug_' . $permalink_base,
|
||||
'value' => strtolower( $raw_value ),
|
||||
'compare' => '=',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
$ids = new \WP_User_Query( $args );
|
||||
|
||||
if( $ids->total_users > 0 ){
|
||||
if ( $ids->total_users > 0 ) {
|
||||
$um_user_query = current( $ids->get_results() );
|
||||
return $um_user_query->ID;
|
||||
}
|
||||
|
||||
// Search by Display Name or ID
|
||||
$args = array(
|
||||
"fields" => array("ID"),
|
||||
"search" => $value,
|
||||
'search_columns' => array( 'display_name','ID' )
|
||||
'fields' => array( 'ID' ),
|
||||
'search' => $value,
|
||||
'search_columns' => array( 'display_name', 'ID' ),
|
||||
);
|
||||
|
||||
$ids = new \WP_User_Query( $args );
|
||||
|
||||
if( $ids->total_users > 0 ){
|
||||
if ( $ids->total_users > 0 ) {
|
||||
$um_user_query = current( $ids->get_results() );
|
||||
return $um_user_query->ID;
|
||||
}
|
||||
|
||||
|
||||
// Search By User Login
|
||||
$value = str_replace(".", "_", $value );
|
||||
$value = str_replace(" ", "", $value );
|
||||
$value = str_replace( ".", "_", $value );
|
||||
$value = str_replace( " ", "", $value );
|
||||
|
||||
$args = array(
|
||||
"fields" => array("ID"),
|
||||
"search" => $value,
|
||||
'search_columns' => array(
|
||||
'fields' => array( 'ID' ),
|
||||
'search' => $value,
|
||||
'search_columns' => array(
|
||||
'user_login',
|
||||
)
|
||||
);
|
||||
|
||||
$ids = new \WP_User_Query( $args );
|
||||
|
||||
if( $ids->total_users > 0 ){
|
||||
if ( $ids->total_users > 0 ) {
|
||||
$um_user_query = current( $ids->get_results() );
|
||||
return $um_user_query->ID;
|
||||
}
|
||||
@@ -1846,7 +1859,7 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
*/
|
||||
function user_exists_by_id( $user_id ) {
|
||||
$aux = get_userdata( intval( $user_id ) );
|
||||
if( $aux == false ) {
|
||||
if ( $aux == false ) {
|
||||
return false;
|
||||
} else {
|
||||
return $user_id;
|
||||
@@ -1878,8 +1891,8 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
|
||||
$user_id = false;
|
||||
|
||||
$ids = get_users( array( 'fields' => 'ID', 'meta_key' => 'um_email_as_username_'.$slug ) );
|
||||
if ( isset( $ids[0] ) && ! empty( $ids[0] ) ){
|
||||
$ids = get_users( array( 'fields' => 'ID', 'meta_key' => 'um_email_as_username_' . $slug ) );
|
||||
if ( ! empty( $ids[0] ) ) {
|
||||
$user_id = $ids[0];
|
||||
}
|
||||
|
||||
|
||||
@@ -211,10 +211,12 @@ if ( ! class_exists( 'um\core\Validation' ) ) {
|
||||
*/
|
||||
$regex_safe_username = apply_filters('um_validation_safe_username_regex',$this->regex_safe );
|
||||
|
||||
if ( is_email( $string ) )
|
||||
if ( is_email( $string ) ) {
|
||||
return true;
|
||||
if ( !is_email( $string) && !preg_match( $regex_safe_username, $string ) )
|
||||
}
|
||||
if ( ! is_email( $string ) && ! preg_match( $regex_safe_username, $string ) ) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -249,9 +251,9 @@ if ( ! class_exists( 'um\core\Validation' ) ) {
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$regex_safe_string = apply_filters('um_validation_safe_string_regex',$this->regex_safe );
|
||||
$regex_safe_string = apply_filters( 'um_validation_safe_string_regex', $this->regex_safe );
|
||||
|
||||
if ( !preg_match( $regex_safe_string, $string) ){
|
||||
if ( ! preg_match( $regex_safe_string, $string ) ) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -266,10 +268,12 @@ if ( ! class_exists( 'um\core\Validation' ) ) {
|
||||
* @return bool
|
||||
*/
|
||||
function is_phone_number( $string ) {
|
||||
if ( !$string )
|
||||
if ( ! $string ) {
|
||||
return true;
|
||||
if ( !preg_match( $this->regex_phone_number, $string) )
|
||||
}
|
||||
if ( ! preg_match( $this->regex_phone_number, $string ) ) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -283,19 +287,21 @@ if ( ! class_exists( 'um\core\Validation' ) ) {
|
||||
* @return bool
|
||||
*/
|
||||
function is_url( $url, $social = false ){
|
||||
if ( !$url ) return true;
|
||||
if ( ! $url ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( $social ) {
|
||||
|
||||
if ( !filter_var($url, FILTER_VALIDATE_URL) && strstr( $url, $social ) ) { // starts with social requested
|
||||
if ( ! filter_var( $url, FILTER_VALIDATE_URL ) && strstr( $url, $social ) ) { // starts with social requested
|
||||
return true;
|
||||
} else {
|
||||
|
||||
if ( filter_var($url, FILTER_VALIDATE_URL) && strstr( $url, $social ) ) {
|
||||
if ( filter_var( $url, FILTER_VALIDATE_URL ) && strstr( $url, $social ) ) {
|
||||
return true;
|
||||
} elseif ( preg_match( $this->regex_safe, $url) ) {
|
||||
} elseif ( preg_match( $this->regex_safe, $url ) ) {
|
||||
|
||||
if ( strstr( $url, '.com' ) ){
|
||||
if ( strstr( $url, '.com' ) ) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
@@ -307,8 +313,9 @@ if ( ! class_exists( 'um\core\Validation' ) ) {
|
||||
|
||||
} else {
|
||||
|
||||
if ( strstr( $url, 'http://') || strstr( $url, 'https://') )
|
||||
if ( strstr( $url, 'http://' ) || strstr( $url, 'https://' ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -326,8 +333,8 @@ if ( ! class_exists( 'um\core\Validation' ) ) {
|
||||
function randomize( $length = 10 ) {
|
||||
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
$result = '';
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$result .= $characters[rand(0, strlen($characters) - 1)];
|
||||
for ( $i = 0; $i < $length; $i++ ) {
|
||||
$result .= $characters[ rand( 0, strlen( $characters ) - 1 ) ];
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
@@ -354,22 +361,19 @@ if ( ! class_exists( 'um\core\Validation' ) ) {
|
||||
*/
|
||||
function random_number( $len = false ) {
|
||||
$ints = array();
|
||||
$len = $len ? $len : rand(2,9);
|
||||
if($len > 9)
|
||||
{
|
||||
trigger_error('Maximum length should not exceed 9');
|
||||
$len = $len ? $len : rand( 2, 9 );
|
||||
if ( $len > 9 ) {
|
||||
trigger_error( 'Maximum length should not exceed 9' );
|
||||
return 0;
|
||||
}
|
||||
while(true)
|
||||
{
|
||||
|
||||
while( true ) {
|
||||
$current = rand(0,9);
|
||||
if(!in_array($current,$ints))
|
||||
{
|
||||
if ( ! in_array( $current, $ints ) ) {
|
||||
$ints[] = $current;
|
||||
}
|
||||
if(count($ints) == $len)
|
||||
{
|
||||
return implode($ints);
|
||||
if ( count( $ints ) == $len ) {
|
||||
return implode( $ints );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -383,11 +387,19 @@ if ( ! class_exists( 'um\core\Validation' ) ) {
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function validate_date( $date, $format='YYYY/MM/D' ) {
|
||||
if ( strlen( $date ) < strlen($format) ) return false;
|
||||
if ( $date[4] != '/' ) return false;
|
||||
if ( $date[7] != '/' ) return false;
|
||||
if ( false === strtotime($date) ) return false;
|
||||
function validate_date( $date, $format = 'YYYY/MM/D' ) {
|
||||
if ( strlen( $date ) < strlen( $format ) ) {
|
||||
return false;
|
||||
}
|
||||
if ( $date[4] != '/' ) {
|
||||
return false;
|
||||
}
|
||||
if ( $date[7] != '/' ) {
|
||||
return false;
|
||||
}
|
||||
if ( false === strtotime( $date ) ) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<?php
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
|
||||
/**
|
||||
* Validate for errors in account form
|
||||
@@ -250,7 +249,7 @@ function um_submit_account_details( $args ) {
|
||||
* ?>
|
||||
*/
|
||||
$secure_fields = apply_filters( 'um_secure_account_fields', $account_fields, um_user( 'ID' ) );
|
||||
|
||||
|
||||
if ( is_array( $secure_fields ) ) {
|
||||
foreach ( $secure_fields as $tab_key => $fields ) {
|
||||
foreach ( $fields as $key => $value ) {
|
||||
@@ -259,17 +258,17 @@ function um_submit_account_details( $args ) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$changes = array();
|
||||
foreach ( $_POST as $k => $v ) {
|
||||
if ( strstr( $k, 'password' ) || strstr( $k, 'um_account' ) || ! in_array( $k, $arr_fields ) )
|
||||
if ( strstr( $k, 'password' ) || strstr( $k, 'um_account' ) || ! in_array( $k, $arr_fields ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$changes[ $k ] = $v;
|
||||
}
|
||||
|
||||
if ( isset( $changes['hide_in_members'] ) && ( $changes['hide_in_members'] == __('No','ultimate-member') || $changes['hide_in_members'] == 'No' ) ) {
|
||||
delete_user_meta( um_user('ID'), 'hide_in_members' );
|
||||
if ( isset( $changes['hide_in_members'] ) && ( $changes['hide_in_members'] == __( 'No', 'ultimate-member' ) || $changes['hide_in_members'] == 'No' ) ) {
|
||||
delete_user_meta( um_user( 'ID' ), 'hide_in_members' );
|
||||
unset( $changes['hide_in_members'] );
|
||||
}
|
||||
|
||||
@@ -391,7 +390,7 @@ function um_account_page_hidden_fields( $args ) {
|
||||
?>
|
||||
|
||||
<input type="hidden" name="_um_account" id="_um_account" value="1" />
|
||||
<input type="hidden" name="_um_account_tab" id="_um_account_tab" value="<?php echo UM()->account()->current_tab;?>" />
|
||||
<input type="hidden" name="_um_account_tab" id="_um_account_tab" value="<?php echo esc_attr( UM()->account()->current_tab ); ?>" />
|
||||
|
||||
<?php
|
||||
}
|
||||
@@ -433,7 +432,7 @@ add_action( 'um_before_account_notifications', 'um_before_account_notifications'
|
||||
*/
|
||||
function um_account_secure_registered_fields(){
|
||||
$secure_fields = UM()->account()->register_fields;
|
||||
update_user_meta( um_user('ID'), 'um_account_secure_fields', $secure_fields );
|
||||
update_user_meta( um_user( 'ID' ), 'um_account_secure_fields', $secure_fields );
|
||||
}
|
||||
add_action( 'wp_footer', 'um_account_secure_registered_fields' );
|
||||
|
||||
|
||||
@@ -450,23 +450,23 @@ function um_submit_form_errors_hook_( $args ) {
|
||||
}
|
||||
|
||||
if ( isset( $array['min_chars'] ) && $array['min_chars'] > 0 ) {
|
||||
if ( $args[$key] && strlen( utf8_decode( $args[$key] ) ) < $array['min_chars'] ) {
|
||||
if ( $args[$key] && strlen( utf8_decode( $args[ $key ] ) ) < $array['min_chars'] ) {
|
||||
UM()->form()->add_error($key, sprintf(__('Your %s must contain at least %s characters','ultimate-member'), $array['label'], $array['min_chars']) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $array['max_chars'] ) && $array['max_chars'] > 0 ) {
|
||||
if ( $args[$key] && strlen( utf8_decode( $args[$key] ) ) > $array['max_chars'] ) {
|
||||
if ( $args[$key] && strlen( utf8_decode( $args[ $key ] ) ) > $array['max_chars'] ) {
|
||||
UM()->form()->add_error($key, sprintf(__('Your %s must contain less than %s characters','ultimate-member'), $array['label'], $array['max_chars']) );
|
||||
}
|
||||
}
|
||||
|
||||
$profile_show_html_bio = UM()->options()->get('profile_show_html_bio');
|
||||
|
||||
if( $profile_show_html_bio == 1 && $key !== "description" ){
|
||||
if ( $profile_show_html_bio == 1 && $key !== "description" ) {
|
||||
if ( isset( $array['html'] ) && $array['html'] == 0 ) {
|
||||
if ( wp_strip_all_tags( $args[$key] ) != trim( $args[$key] ) ) {
|
||||
UM()->form()->add_error($key, __('You can not use HTML tags here','ultimate-member') );
|
||||
if ( wp_strip_all_tags( $args[$key] ) != trim( $args[ $key ] ) ) {
|
||||
UM()->form()->add_error( $key, __( 'You can not use HTML tags here', 'ultimate-member' ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -708,7 +708,7 @@ function um_submit_form_errors_hook_( $args ) {
|
||||
|
||||
case 'alphabetic':
|
||||
|
||||
if ( $args[$key] != '' ) {
|
||||
if ( $args[ $key ] != '' ) {
|
||||
|
||||
if( ! ctype_alpha( str_replace(' ', '', $args[$key] ) ) ){
|
||||
UM()->form()->add_error( $key , __('You must provide alphabetic letters','ultimate-member') );
|
||||
@@ -718,9 +718,9 @@ function um_submit_form_errors_hook_( $args ) {
|
||||
|
||||
case 'lowercase':
|
||||
|
||||
if ( $args[$key] != '' ) {
|
||||
if ( $args[ $key ] != '' ) {
|
||||
|
||||
if( ! ctype_lower( str_replace(' ', '',$args[$key] ) ) ){
|
||||
if ( ! ctype_lower( str_replace(' ', '',$args[$key] ) ) ){
|
||||
UM()->form()->add_error( $key , __('You must provide lowercase letters.','ultimate-member') );
|
||||
}
|
||||
}
|
||||
@@ -734,12 +734,11 @@ function um_submit_form_errors_hook_( $args ) {
|
||||
}
|
||||
|
||||
if ( isset( $args['description'] ) ) {
|
||||
|
||||
$max_chars = UM()->options()->get('profile_bio_maxchars');
|
||||
$profile_show_bio = UM()->options()->get('profile_show_bio');
|
||||
$max_chars = UM()->options()->get( 'profile_bio_maxchars' );
|
||||
$profile_show_bio = UM()->options()->get( 'profile_show_bio' );
|
||||
|
||||
if( $profile_show_bio ){
|
||||
if( strlen( utf8_decode( str_replace( array( "\r\n", "\n", "\r\t", "\t" ), ' ', $args[ 'description' ] ) ) ) > $max_chars && $max_chars ) {
|
||||
if ( $profile_show_bio ) {
|
||||
if ( strlen( utf8_decode( str_replace( array( "\r\n", "\n", "\r\t", "\t" ), ' ', $args['description'] ) ) ) > $max_chars && $max_chars ) {
|
||||
UM()->form()->add_error( 'description', sprintf( __( 'Your user description must contain less than %s characters', 'ultimate-member' ), $max_chars ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
function um_add_form_identifier( $args ) {
|
||||
?>
|
||||
<input type="hidden" name="form_id" id="form_id_<?php echo $args['form_id']; ?>" value="<?php echo $args['form_id']; ?>" />
|
||||
<input type="hidden" name="form_id" id="form_id_<?php echo esc_attr( $args['form_id'] ); ?>" value="<?php echo esc_attr( $args['form_id'] ); ?>" />
|
||||
<?php
|
||||
}
|
||||
add_action( 'um_after_form_fields', 'um_add_form_identifier' );
|
||||
@@ -24,11 +24,11 @@ function um_add_security_checks( $args ) {
|
||||
return;
|
||||
} ?>
|
||||
|
||||
<input type="hidden" name="timestamp" class="um_timestamp" value="<?php echo current_time( 'timestamp' ) ?>" />
|
||||
<input type="hidden" name="timestamp" class="um_timestamp" value="<?php echo esc_attr( current_time( 'timestamp' ) ) ?>" />
|
||||
|
||||
<p class="<?php echo UM()->honeypot; ?>_name">
|
||||
<label for="<?php echo UM()->honeypot . '_' . $args['form_id']; ?>"><?php _e( 'Only fill in if you are not human' ); ?></label>
|
||||
<input type="text" name="<?php echo UM()->honeypot; ?>" id="<?php echo UM()->honeypot . '_' . $args['form_id']; ?>" class="input" value="" size="25" autocomplete="off" />
|
||||
<p class="<?php echo esc_attr( UM()->honeypot ); ?>_name">
|
||||
<label for="<?php echo esc_attr( UM()->honeypot ) . '_' . $args['form_id']; ?>"><?php _e( 'Only fill in if you are not human' ); ?></label>
|
||||
<input type="text" name="<?php echo esc_attr( UM()->honeypot ); ?>" id="<?php echo esc_attr( UM()->honeypot ) . '_' . $args['form_id']; ?>" class="input" value="" size="25" autocomplete="off" />
|
||||
</p>
|
||||
|
||||
<?php
|
||||
@@ -43,7 +43,7 @@ add_action( 'um_account_page_hidden_fields', 'um_add_security_checks' );
|
||||
function um_add_form_honeypot_css() {
|
||||
?>
|
||||
<style type="text/css">
|
||||
.<?php echo UM()->honeypot; ?>_name {
|
||||
.<?php echo esc_attr( UM()->honeypot ); ?>_name {
|
||||
display: none !important;
|
||||
}
|
||||
</style>
|
||||
@@ -57,7 +57,7 @@ add_action( 'wp_head', 'um_add_form_honeypot_css' );
|
||||
function um_add_form_honeypot_js() {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
jQuery( '#<?php echo UM()->honeypot; ?>' ).val( '' );
|
||||
jQuery( '#<?php echo esc_js( UM()->honeypot ); ?>' ).val( '' );
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
@@ -15,15 +15,15 @@ function um_submit_form_errors_hook_login( $args ) {
|
||||
|
||||
|
||||
if ( isset( $args['username'] ) && $args['username'] == '' ) {
|
||||
UM()->form()->add_error( 'username', __('Please enter your username or email','ultimate-member') );
|
||||
UM()->form()->add_error( 'username', __( 'Please enter your username or email', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
if ( isset( $args['user_login'] ) && $args['user_login'] == '' ) {
|
||||
UM()->form()->add_error( 'user_login', __('Please enter your username','ultimate-member') );
|
||||
UM()->form()->add_error( 'user_login', __( 'Please enter your username', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
if ( isset( $args['user_email'] ) && $args['user_email'] == '' ) {
|
||||
UM()->form()->add_error( 'user_email', __('Please enter your email','ultimate-member') );
|
||||
UM()->form()->add_error( 'user_email', __( 'Please enter your email', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
if ( isset( $args['username'] ) ) {
|
||||
@@ -35,7 +35,7 @@ function um_submit_form_errors_hook_login( $args ) {
|
||||
} else {
|
||||
$user_name = $args['username'];
|
||||
}
|
||||
} else if ( isset( $args['user_email'] ) ) {
|
||||
} elseif ( isset( $args['user_email'] ) ) {
|
||||
$field = 'user_email';
|
||||
$is_email = true;
|
||||
$data = get_user_by('email', $args['user_email'] );
|
||||
@@ -45,48 +45,35 @@ function um_submit_form_errors_hook_login( $args ) {
|
||||
$user_name = $args['user_login'];
|
||||
}
|
||||
|
||||
/*if ( !username_exists( $user_name ) ) {
|
||||
if ( $is_email ) {
|
||||
UM()->form()->add_error( $field, __(' Sorry, we can\'t find an account with that email address','ultimate-member') );
|
||||
} else {
|
||||
UM()->form()->add_error( $field, __(' Sorry, we can\'t find an account with that username','ultimate-member') );
|
||||
}
|
||||
} else {
|
||||
|
||||
}*/
|
||||
|
||||
if ( $args['user_password'] == '' ) {
|
||||
UM()->form()->add_error( 'user_password', __('Please enter your password','ultimate-member') );
|
||||
UM()->form()->add_error( 'user_password', __( 'Please enter your password', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
$user = get_user_by( 'login', $user_name );
|
||||
if ( $user && wp_check_password( $args['user_password'], $user->data->user_pass, $user->ID) ) {
|
||||
if ( $user && wp_check_password( $args['user_password'], $user->data->user_pass, $user->ID ) ) {
|
||||
UM()->login()->auth_id = username_exists( $user_name );
|
||||
} else {
|
||||
UM()->form()->add_error( 'user_password', __('Password is incorrect. Please try again.','ultimate-member') );
|
||||
UM()->form()->add_error( 'user_password', __( 'Password is incorrect. Please try again.', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
$user = apply_filters( 'authenticate', null, $user_name, $args['user_password'] );
|
||||
|
||||
|
||||
$authenticate_user = apply_filters( 'wp_authenticate_user', $user_name, $args['user_password'] );
|
||||
|
||||
|
||||
// @since 4.18 replacement for 'wp_login_failed' action hook
|
||||
// see WP function wp_authenticate()
|
||||
$ignore_codes = array('empty_username', 'empty_password');
|
||||
|
||||
if ( is_wp_error( $user ) && ! in_array( $user->get_error_code(), $ignore_codes ) ) {
|
||||
|
||||
UM()->form()->add_error( $user->get_error_code(), __( $user->get_error_message() ,'ultimate-member') );
|
||||
UM()->form()->add_error( $user->get_error_code(), __( $user->get_error_message(), 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
if( is_wp_error( $authenticate_user ) && ! in_array( $authenticate_user->get_error_code(), $ignore_codes ) ){
|
||||
|
||||
UM()->form()->add_error( $authenticate_user->get_error_code(), __( $authenticate_user->get_error_message() ,'ultimate-member') );
|
||||
|
||||
if ( is_wp_error( $authenticate_user ) && ! in_array( $authenticate_user->get_error_code(), $ignore_codes ) ) {
|
||||
UM()->form()->add_error( $authenticate_user->get_error_code(), __( $authenticate_user->get_error_message(), 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
// if there is an error notify wp
|
||||
if( UM()->form()->has_error( $field ) || UM()->form()->has_error( $user_password ) || UM()->form()->count_errors() > 0 ) {
|
||||
if ( UM()->form()->has_error( $field ) || UM()->form()->has_error( $user_password ) || UM()->form()->count_errors() > 0 ) {
|
||||
do_action( 'wp_login_failed', $user_name );
|
||||
}
|
||||
}
|
||||
@@ -138,7 +125,7 @@ function um_submit_form_errors_hook_logincheck( $args ) {
|
||||
$user_id = ( isset( UM()->login()->auth_id ) ) ? UM()->login()->auth_id : '';
|
||||
um_fetch_user( $user_id );
|
||||
|
||||
$status = um_user('account_status'); // account status
|
||||
$status = um_user( 'account_status' ); // account status
|
||||
switch( $status ) {
|
||||
|
||||
// If user can't login to site...
|
||||
@@ -152,7 +139,7 @@ function um_submit_form_errors_hook_logincheck( $args ) {
|
||||
|
||||
}
|
||||
|
||||
if ( isset( $args['form_id'] ) && $args['form_id'] == UM()->shortcodes()->core_login_form() && UM()->form()->errors && !isset( $_POST[ UM()->honeypot ] ) ) {
|
||||
if ( isset( $args['form_id'] ) && $args['form_id'] == UM()->shortcodes()->core_login_form() && UM()->form()->errors && ! isset( $_POST[ UM()->honeypot ] ) ) {
|
||||
exit( wp_redirect( um_get_core_page('login') ) );
|
||||
}
|
||||
|
||||
@@ -226,10 +213,11 @@ function um_user_login( $args ) {
|
||||
|
||||
// Role redirect
|
||||
$after_login = um_user( 'after_login' );
|
||||
if ( empty( $after_login ) )
|
||||
if ( empty( $after_login ) ) {
|
||||
exit( wp_redirect( um_user_profile_url() ) );
|
||||
}
|
||||
|
||||
switch( $after_login ) {
|
||||
switch ( $after_login ) {
|
||||
|
||||
case 'redirect_admin':
|
||||
exit( wp_redirect( admin_url() ) );
|
||||
@@ -268,8 +256,8 @@ function um_user_login( $args ) {
|
||||
|
||||
case 'redirect_profile':
|
||||
default:
|
||||
exit( wp_redirect( um_user_profile_url() ) );
|
||||
break;
|
||||
exit( wp_redirect( um_user_profile_url() ) );
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -389,7 +377,7 @@ function um_add_submit_button_to_login( $args ) {
|
||||
*/
|
||||
$secondary_btn_word = apply_filters( 'um_login_form_button_two', $args['secondary_btn_word'], $args );
|
||||
|
||||
$secondary_btn_url = ( isset( $args['secondary_btn_url'] ) && $args['secondary_btn_url'] ) ? $args['secondary_btn_url'] : um_get_core_page('register');
|
||||
$secondary_btn_url = ! empty( $args['secondary_btn_url'] ) ? $args['secondary_btn_url'] : um_get_core_page( 'register' );
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
@@ -412,7 +400,7 @@ function um_add_submit_button_to_login( $args ) {
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$secondary_btn_url = apply_filters('um_login_form_button_two_url', $secondary_btn_url, $args ); ?>
|
||||
$secondary_btn_url = apply_filters( 'um_login_form_button_two_url', $secondary_btn_url, $args ); ?>
|
||||
|
||||
<div class="um-col-alt">
|
||||
|
||||
@@ -427,7 +415,7 @@ function um_add_submit_button_to_login( $args ) {
|
||||
<input type="submit" value="<?php esc_attr_e( wp_unslash( $primary_btn_word ), 'ultimate-member' ); ?>" class="um-button" id="um-submit-btn" />
|
||||
</div>
|
||||
<div class="um-right um-half">
|
||||
<a href="<?php echo esc_attr( $secondary_btn_url ); ?>" class="um-button um-alt">
|
||||
<a href="<?php echo esc_url( $secondary_btn_url ); ?>" class="um-button um-alt">
|
||||
<?php _e( wp_unslash( $secondary_btn_word ), 'ultimate-member' ); ?>
|
||||
</a>
|
||||
</div>
|
||||
@@ -460,7 +448,7 @@ function um_after_login_submit( $args ) {
|
||||
} ?>
|
||||
|
||||
<div class="um-col-alt-b">
|
||||
<a href="<?php echo um_get_core_page('password-reset'); ?>" class="um-link-alt">
|
||||
<a href="<?php echo esc_url( um_get_core_page( 'password-reset' ) ); ?>" class="um-link-alt">
|
||||
<?php _e( 'Forgot your password?', 'ultimate-member' ); ?>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
function um_members_directory_search( $args ) {
|
||||
$search_filters = array();
|
||||
|
||||
if ( isset($args['search_fields']) ) {
|
||||
foreach( $args['search_fields'] as $k => $testfilter ){
|
||||
if ($testfilter && !in_array( $testfilter, (array)$search_filters ) ) {
|
||||
if ( isset( $args['search_fields'] ) ) {
|
||||
foreach ( $args['search_fields'] as $k => $testfilter ) {
|
||||
if ( $testfilter && ! in_array( $testfilter, (array) $search_filters ) ) {
|
||||
$search_filters[] = $testfilter;
|
||||
}
|
||||
}
|
||||
@@ -49,13 +49,13 @@ function um_members_directory_search( $args ) {
|
||||
|
||||
$count = count( $search_filters ); ?>
|
||||
|
||||
<div class="um-search um-search-<?php echo $count; ?>">
|
||||
<div class="um-search um-search-<?php echo esc_attr( $count ); ?>">
|
||||
|
||||
<form method="get" action="">
|
||||
|
||||
<?php if ( isset( $_REQUEST['page_id'] ) && get_option('permalink_structure') == 0 ) { ?>
|
||||
<?php if ( isset( $_REQUEST['page_id'] ) && get_option( 'permalink_structure' ) == 0 ) { ?>
|
||||
|
||||
<input type="hidden" name="page_id" id="page_id" value="<?php echo esc_attr( $_REQUEST['page_id']); ?>" />
|
||||
<input type="hidden" name="page_id" id="page_id" value="<?php echo esc_attr( $_REQUEST['page_id'] ); ?>" />
|
||||
|
||||
<?php }
|
||||
|
||||
@@ -69,7 +69,7 @@ function um_members_directory_search( $args ) {
|
||||
$add_class = '';
|
||||
} ?>
|
||||
|
||||
<div class="um-search-filter <?php echo $add_class ?>">
|
||||
<div class="um-search-filter <?php echo esc_attr( $add_class ) ?>">
|
||||
<?php UM()->members()->show_filter( $filter ); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
@@ -80,15 +80,15 @@ function um_members_directory_search( $args ) {
|
||||
|
||||
<input type="hidden" name="um_search" id="um_search" value="1" />
|
||||
|
||||
<a href="#" class="um-button um-do-search"><?php _e('Search','ultimate-member'); ?></a>
|
||||
<a href="<?php echo UM()->permalinks()->get_current_url( true ); ?>" class="um-button um-alt"><?php _e('Reset','ultimate-member'); ?></a>
|
||||
<a href="javascript:void(0);" class="um-button um-do-search"><?php _e('Search','ultimate-member' ); ?></a>
|
||||
<a href="<?php echo esc_url( UM()->permalinks()->get_current_url( true ) ); ?>" class="um-button um-alt"><?php _e( 'Reset', 'ultimate-member' ); ?></a>
|
||||
|
||||
</div>
|
||||
<div class="um-clear"></div>
|
||||
|
||||
</form>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
@@ -117,19 +117,19 @@ add_action( 'um_pre_directory_shortcode', 'um_pre_directory_shortcode' );
|
||||
function um_members_directory_head( $args ) {
|
||||
extract( $args );
|
||||
|
||||
if ( isset($_REQUEST['um_search']) ) {
|
||||
if ( isset( $_REQUEST['um_search'] ) ) {
|
||||
$is_filtering = 1;
|
||||
} else if ( UM()->is_filtering == 1 ) {
|
||||
} elseif ( UM()->is_filtering == 1 ) {
|
||||
$is_filtering = 1;
|
||||
} else {
|
||||
$is_filtering = 0;
|
||||
}
|
||||
|
||||
if ( um_members('header') && $is_filtering && um_members('users_per_page') ) { ?>
|
||||
if ( um_members( 'header' ) && $is_filtering && um_members( 'users_per_page' ) ) { ?>
|
||||
|
||||
<div class="um-members-intro">
|
||||
|
||||
<div class="um-members-total"><?php echo ( um_members('total_users') > 1 ) ? um_members('header') : um_members('header_single'); ?></div>
|
||||
<div class="um-members-total"><?php echo ( um_members( 'total_users' ) > 1 ) ? um_members( 'header' ) : um_members( 'header_single' ); ?></div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -147,68 +147,70 @@ function um_members_directory_pagination( $args ) {
|
||||
extract( $args );
|
||||
|
||||
|
||||
if ( isset( $args['search'] ) && $args['search'] == 1 && isset( $args['must_search'] ) && $args['must_search'] == 1 && !isset( $_REQUEST['um_search'] ) )
|
||||
if ( isset( $args['search'] ) && $args['search'] == 1 && isset( $args['must_search'] ) && $args['must_search'] == 1 && ! isset( $_REQUEST['um_search'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( um_members('total_pages') > 1 ) { // needs pagination
|
||||
|
||||
?>
|
||||
|
||||
<div class="um-members-pagidrop uimob340-show uimob500-show">
|
||||
<div class="um-members-pagidrop uimob340-show uimob500-show">
|
||||
|
||||
<?php _e('Jump to page:','ultimate-member'); ?>
|
||||
<?php _e( 'Jump to page:', 'ultimate-member' ); ?>
|
||||
|
||||
<?php if ( um_members('pages_to_show') && is_array( um_members('pages_to_show') ) ) { ?>
|
||||
<select onChange="window.location.href=this.value" class="um-s2" style="width: 100px">
|
||||
<?php foreach( um_members('pages_to_show') as $i ) { ?>
|
||||
<option value="<?php echo UM()->permalinks()->add_query( 'members_page', $i ); ?>" <?php selected($i, um_members('page')); ?>><?php printf(__('%s of %d','ultimate-member'), $i, um_members('total_pages') ); ?></option>
|
||||
<?php if ( um_members( 'pages_to_show' ) && is_array( um_members( 'pages_to_show' ) ) ) { ?>
|
||||
<select onChange="window.location.href=this.value" class="um-s2" style="width: 100px">
|
||||
<?php foreach( um_members( 'pages_to_show' ) as $i ) { ?>
|
||||
<option value="<?php echo esc_url( UM()->permalinks()->add_query( 'members_page', $i ) ); ?>" <?php selected( $i, um_members( 'page' ) ); ?>><?php printf( __( '%s of %d', 'ultimate-member' ), $i, um_members( 'total_pages' ) ); ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</select>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="um-members-pagi uimob340-hide uimob500-hide">
|
||||
<div class="um-members-pagi uimob340-hide uimob500-hide">
|
||||
|
||||
<?php if ( um_members('page') != 1 ) { ?>
|
||||
<a href="<?php echo UM()->permalinks()->add_query( 'members_page', 1 ); ?>" class="pagi pagi-arrow um-tip-n" title="<?php _e('First Page','ultimate-member'); ?>"><i class="um-faicon-angle-double-left"></i></a>
|
||||
<?php if ( um_members( 'page' ) != 1 ) { ?>
|
||||
<a href="<?php echo esc_url( UM()->permalinks()->add_query( 'members_page', 1 ) ); ?>" class="pagi pagi-arrow um-tip-n" title="<?php esc_attr_e( 'First Page', 'ultimate-member' ); ?>"><i class="um-faicon-angle-double-left"></i></a>
|
||||
<?php } else { ?>
|
||||
<span class="pagi pagi-arrow disabled"><i class="um-faicon-angle-double-left"></i></span>
|
||||
<?php } ?>
|
||||
<span class="pagi pagi-arrow disabled"><i class="um-faicon-angle-double-left"></i></span>
|
||||
<?php }
|
||||
|
||||
<?php if ( um_members('page') > 1 ) { ?>
|
||||
<a href="<?php echo UM()->permalinks()->add_query( 'members_page', um_members('page') - 1 ); ?>" class="pagi pagi-arrow um-tip-n" title="<?php _e('Previous','ultimate-member'); ?>"><i class="um-faicon-angle-left"></i></a>
|
||||
if ( um_members( 'page' ) > 1 ) { ?>
|
||||
<a href="<?php echo UM()->permalinks()->add_query( 'members_page', um_members( 'page' ) - 1 ); ?>" class="pagi pagi-arrow um-tip-n" title="<?php esc_attr_e( 'Previous', 'ultimate-member'); ?>"><i class="um-faicon-angle-left"></i></a>
|
||||
<?php } else { ?>
|
||||
<span class="pagi pagi-arrow disabled"><i class="um-faicon-angle-left"></i></span>
|
||||
<?php } ?>
|
||||
<span class="pagi pagi-arrow disabled"><i class="um-faicon-angle-left"></i></span>
|
||||
<?php }
|
||||
|
||||
<?php if ( um_members('pages_to_show') && is_array( um_members('pages_to_show') ) ) { ?>
|
||||
<?php foreach( um_members('pages_to_show') as $i ) { ?>
|
||||
if ( um_members('pages_to_show') && is_array( um_members( 'pages_to_show' ) ) ) {
|
||||
foreach ( um_members( 'pages_to_show' ) as $i ) {
|
||||
|
||||
if ( um_members('page') == $i ) { ?>
|
||||
|
||||
<span class="pagi current"><?php echo $i; ?></span>
|
||||
|
||||
<?php if ( um_members('page') == $i ) { ?>
|
||||
<span class="pagi current"><?php echo $i; ?></span>
|
||||
<?php } else { ?>
|
||||
|
||||
<a href="<?php echo UM()->permalinks()->add_query( 'members_page', $i ); ?>" class="pagi"><?php echo $i; ?></a>
|
||||
<a href="<?php echo esc_url( UM()->permalinks()->add_query( 'members_page', $i ) ); ?>" class="pagi"><?php echo $i; ?></a>
|
||||
|
||||
<?php } ?>
|
||||
<?php }
|
||||
}
|
||||
}
|
||||
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ( um_members('page') != um_members('total_pages') ) { ?>
|
||||
<a href="<?php echo UM()->permalinks()->add_query( 'members_page', um_members('page') + 1 ); ?>" class="pagi pagi-arrow um-tip-n" title="<?php _e('Next','ultimate-member'); ?>"><i class="um-faicon-angle-right"></i></a>
|
||||
if ( um_members('page') != um_members( 'total_pages' ) ) { ?>
|
||||
<a href="<?php echo esc_url( UM()->permalinks()->add_query( 'members_page', um_members( 'page' ) + 1 ) ); ?>" class="pagi pagi-arrow um-tip-n" title="<?php esc_attr_e('Next','ultimate-member'); ?>"><i class="um-faicon-angle-right"></i></a>
|
||||
<?php } else { ?>
|
||||
<span class="pagi pagi-arrow disabled"><i class="um-faicon-angle-right"></i></span>
|
||||
<?php } ?>
|
||||
<span class="pagi pagi-arrow disabled"><i class="um-faicon-angle-right"></i></span>
|
||||
<?php }
|
||||
|
||||
<?php if ( um_members('page') != um_members('total_pages') ) { ?>
|
||||
<a href="<?php echo UM()->permalinks()->add_query( 'members_page', um_members('total_pages') ); ?>" class="pagi pagi-arrow um-tip-n" title="<?php _e('Last Page','ultimate-member'); ?>"><i class="um-faicon-angle-double-right"></i></a>
|
||||
if ( um_members( 'page' ) != um_members( 'total_pages' ) ) { ?>
|
||||
<a href="<?php echo esc_url( UM()->permalinks()->add_query( 'members_page', um_members( 'total_pages' ) ) ); ?>" class="pagi pagi-arrow um-tip-n" title="<?php esc_attr_e('Last Page','ultimate-member'); ?>"><i class="um-faicon-angle-double-right"></i></a>
|
||||
<?php } else { ?>
|
||||
<span class="pagi pagi-arrow disabled"><i class="um-faicon-angle-double-right"></i></span>
|
||||
<span class="pagi pagi-arrow disabled"><i class="um-faicon-angle-double-right"></i></span>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
@@ -226,16 +228,15 @@ add_action( 'um_members_directory_footer', 'um_members_directory_pagination' );
|
||||
function um_members_directory_display( $args ) {
|
||||
extract( $args );
|
||||
|
||||
if ( isset( $args['search'] ) && $args['search'] == 1 && isset( $args['must_search'] ) && $args['must_search'] == 1 && !isset( $_REQUEST['um_search'] ) )
|
||||
if ( isset( $args['search'] ) && $args['search'] == 1 && isset( $args['must_search'] ) && $args['must_search'] == 1 && ! isset( $_REQUEST['um_search'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( um_members('no_users') ) {
|
||||
if ( um_members( 'no_users' ) ) { ?>
|
||||
|
||||
?>
|
||||
|
||||
<div class="um-members-none">
|
||||
<p><?php echo $args['no_users']; ?></p>
|
||||
</div>
|
||||
<div class="um-members-none">
|
||||
<p><?php echo esc_html( $args['no_users'] ); ?></p>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
@@ -244,7 +245,7 @@ function um_members_directory_display( $args ) {
|
||||
$file = um_path . 'templates/members-grid.php';
|
||||
$theme_file = get_stylesheet_directory() . '/ultimate-member/templates/members-grid.php';
|
||||
|
||||
if ( file_exists( $theme_file ) ){
|
||||
if ( file_exists( $theme_file ) ) {
|
||||
$file = $theme_file;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,10 @@
|
||||
* @param $args
|
||||
*/
|
||||
function um_profile_content_main( $args ) {
|
||||
|
||||
/**
|
||||
* @var $mode
|
||||
*/
|
||||
extract( $args );
|
||||
|
||||
if ( ! UM()->options()->get( 'profile_tab_main' ) && ! isset( $_REQUEST['um_action'] ) ) {
|
||||
@@ -57,7 +61,7 @@ function um_profile_content_main( $args ) {
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
do_action( "um_before_form", $args );
|
||||
do_action( 'um_before_form', $args );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
@@ -162,15 +166,17 @@ function um_profile_content_main( $args ) {
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
do_action( "um_after_form", $args );
|
||||
do_action( 'um_after_form', $args );
|
||||
|
||||
} else { ?>
|
||||
|
||||
<div class="um-profile-note">
|
||||
<span>
|
||||
<i class="um-faicon-lock"></i>
|
||||
<?php echo $can_view; ?>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<?php }
|
||||
}
|
||||
add_action( 'um_profile_content_main', 'um_profile_content_main' );
|
||||
@@ -551,7 +557,7 @@ add_action( 'um_after_form_fields', 'um_editing_user_id_input' );
|
||||
* Meta description
|
||||
*/
|
||||
function um_profile_dynamic_meta_desc() {
|
||||
if (um_is_core_page( 'user' ) && um_get_requested_user()) {
|
||||
if ( um_is_core_page( 'user' ) && um_get_requested_user() ) {
|
||||
|
||||
um_fetch_user( um_get_requested_user() );
|
||||
|
||||
@@ -812,13 +818,13 @@ function um_profile_header( $args ) {
|
||||
*/
|
||||
$items = apply_filters( 'um_user_photo_menu_view', $items );
|
||||
|
||||
echo UM()->profile()->new_ui( 'bc', 'div.um-profile-photo', 'click', $items );
|
||||
UM()->profile()->new_ui( 'bc', 'div.um-profile-photo', 'click', $items );
|
||||
|
||||
} elseif ( UM()->fields()->editing == true ) {
|
||||
|
||||
$items = array(
|
||||
'<a href="javascript:void(0);" class="um-manual-trigger" data-parent=".um-profile-photo" data-child=".um-btn-auto-width">' . __( 'Change photo', 'ultimate-member' ) . '</a>',
|
||||
'<a href="javascript:void(0);" class="um-reset-profile-photo" data-user_id="' . um_profile_id() . '" data-default_src="' . um_get_default_avatar_uri() . '">' . __( 'Remove photo', 'ultimate-member' ) . '</a>',
|
||||
'<a href="javascript:void(0);" class="um-reset-profile-photo" data-user_id="' . esc_attr( um_profile_id() ) . '" data-default_src="' . esc_url( um_get_default_avatar_uri() ) . '">' . __( 'Remove photo', 'ultimate-member' ) . '</a>',
|
||||
'<a href="javascript:void(0);" class="um-dropdown-hide">' . __( 'Cancel', 'ultimate-member' ) . '</a>',
|
||||
);
|
||||
|
||||
@@ -845,7 +851,7 @@ function um_profile_header( $args ) {
|
||||
*/
|
||||
$items = apply_filters( 'um_user_photo_menu_edit', $items );
|
||||
|
||||
echo UM()->profile()->new_ui( 'bc', 'div.um-profile-photo', 'click', $items );
|
||||
UM()->profile()->new_ui( 'bc', 'div.um-profile-photo', 'click', $items );
|
||||
|
||||
}
|
||||
|
||||
@@ -960,14 +966,13 @@ function um_profile_header( $args ) {
|
||||
<?php echo UM()->profile()->show_meta( $args['metafields'] ); ?>
|
||||
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php }
|
||||
|
||||
<?php if (UM()->fields()->viewing == true && um_user( 'description' ) && $args['show_bio']) { ?>
|
||||
if ( UM()->fields()->viewing == true && um_user( 'description' ) && $args['show_bio'] ) { ?>
|
||||
|
||||
<div class="um-meta-text">
|
||||
<?php
|
||||
<?php $description = get_user_meta( um_user( 'ID' ), 'description', true );
|
||||
|
||||
$description = get_user_meta( um_user( 'ID' ), 'description', true );
|
||||
if ( UM()->options()->get( 'profile_show_html_bio' ) ) {
|
||||
echo make_clickable( wpautop( wp_kses_post( $description ) ) );
|
||||
} else {
|
||||
@@ -975,7 +980,7 @@ function um_profile_header( $args ) {
|
||||
} ?>
|
||||
</div>
|
||||
|
||||
<?php } else if (UM()->fields()->editing == true && $args['show_bio']) { ?>
|
||||
<?php } elseif ( UM()->fields()->editing == true && $args['show_bio'] ) { ?>
|
||||
|
||||
<div class="um-meta-text">
|
||||
<textarea id="um-meta-bio"
|
||||
@@ -1072,19 +1077,23 @@ function um_pre_profile_shortcode( $args ) {
|
||||
UM()->fields()->viewing = 1;
|
||||
|
||||
if ( um_get_requested_user() ) {
|
||||
if ( ! um_can_view_profile( um_get_requested_user() ) && ! um_is_myprofile() )
|
||||
if ( ! um_can_view_profile( um_get_requested_user() ) && ! um_is_myprofile() ) {
|
||||
um_redirect_home( um_get_requested_user(), um_is_myprofile() );
|
||||
}
|
||||
|
||||
if ( ! UM()->roles()->um_current_user_can( 'edit', um_get_requested_user() ) )
|
||||
if ( ! UM()->roles()->um_current_user_can( 'edit', um_get_requested_user() ) ) {
|
||||
UM()->user()->cannot_edit = 1;
|
||||
}
|
||||
|
||||
um_fetch_user( um_get_requested_user() );
|
||||
} else {
|
||||
if ( ! is_user_logged_in() )
|
||||
if ( ! is_user_logged_in() ) {
|
||||
um_redirect_home( um_get_requested_user(), um_is_myprofile() );
|
||||
}
|
||||
|
||||
if ( ! um_user( 'can_edit_profile' ) )
|
||||
if ( ! um_user( 'can_edit_profile' ) ) {
|
||||
UM()->user()->cannot_edit = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1120,7 +1129,7 @@ function um_add_edit_icon( $args ) {
|
||||
if ( UM()->fields()->editing == true ) { ?>
|
||||
|
||||
<div class="um-profile-edit um-profile-headericon">
|
||||
<a href="#" class="um-profile-edit-a um-profile-save"><i class="um-faicon-check"></i></a>
|
||||
<a href="javascript:void(0);" class="um-profile-edit-a um-profile-save"><i class="um-faicon-check"></i></a>
|
||||
</div>
|
||||
|
||||
<?php return;
|
||||
@@ -1134,7 +1143,7 @@ function um_add_edit_icon( $args ) {
|
||||
|
||||
$items = UM()->user()->get_admin_actions();
|
||||
if ( UM()->roles()->um_current_user_can( 'edit', um_profile_id() ) ) {
|
||||
$items['editprofile'] = '<a href="' . um_edit_profile_url() . '" class="real_url">' . __( 'Edit Profile', 'ultimate-member' ) . '</a>';
|
||||
$items['editprofile'] = '<a href="' . esc_url( um_edit_profile_url() ) . '" class="real_url">' . __( 'Edit Profile', 'ultimate-member' ) . '</a>';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1161,13 +1170,13 @@ function um_add_edit_icon( $args ) {
|
||||
*/
|
||||
$items = apply_filters( 'um_profile_edit_menu_items', $items, um_profile_id() );
|
||||
|
||||
$items['cancel'] = '<a href="#" class="um-dropdown-hide">' . __( 'Cancel', 'ultimate-member' ) . '</a>';
|
||||
$items['cancel'] = '<a href="javascript:void(0);" class="um-dropdown-hide">' . __( 'Cancel', 'ultimate-member' ) . '</a>';
|
||||
|
||||
} else {
|
||||
$items = array(
|
||||
'editprofile' => '<a href="' . um_edit_profile_url() . '" class="real_url">' . __( 'Edit Profile', 'ultimate-member' ) . '</a>',
|
||||
'myaccount' => '<a href="' . um_get_core_page( 'account' ) . '" class="real_url">' . __( 'My Account', 'ultimate-member' ) . '</a>',
|
||||
'logout' => '<a href="' . um_get_core_page( 'logout' ) . '" class="real_url">' . __( 'Logout', 'ultimate-member' ) . '</a>',
|
||||
'editprofile' => '<a href="' . esc_url( um_edit_profile_url() ) . '" class="real_url">' . __( 'Edit Profile', 'ultimate-member' ) . '</a>',
|
||||
'myaccount' => '<a href="' . esc_url( um_get_core_page( 'account' ) ) . '" class="real_url">' . __( 'My Account', 'ultimate-member' ) . '</a>',
|
||||
'logout' => '<a href="' . esc_url( um_get_core_page( 'logout' ) ) . '" class="real_url">' . __( 'Logout', 'ultimate-member' ) . '</a>',
|
||||
'cancel' => '<a href="javascript:void(0);" class="um-dropdown-hide">' . __( 'Cancel', 'ultimate-member' ) . '</a>',
|
||||
);
|
||||
|
||||
@@ -1201,7 +1210,7 @@ function um_add_edit_icon( $args ) {
|
||||
|
||||
<div class="um-profile-edit um-profile-headericon">
|
||||
|
||||
<a href="#" class="um-profile-edit-a"><i class="um-faicon-cog"></i></a>
|
||||
<a href="javascript:void(0);" class="um-profile-edit-a"><i class="um-faicon-cog"></i></a>
|
||||
|
||||
<?php UM()->profile()->new_ui( $args['header_menu'], 'div.um-profile-edit', 'click', $items ); ?>
|
||||
|
||||
@@ -1275,12 +1284,14 @@ add_action( 'um_submit_form_profile', 'um_submit_form_profile', 10 );
|
||||
*/
|
||||
function um_add_submit_button_to_profile( $args ) {
|
||||
// DO NOT add when reviewing user's details
|
||||
if (UM()->user()->preview == true && is_admin()) return;
|
||||
if ( UM()->user()->preview == true && is_admin() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// only when editing
|
||||
if (UM()->fields()->editing == false) return;
|
||||
|
||||
?>
|
||||
if ( UM()->fields()->editing == false ) {
|
||||
return;
|
||||
} ?>
|
||||
|
||||
<div class="um-col-alt">
|
||||
|
||||
@@ -1336,7 +1347,7 @@ function um_profile_menu( $args ) {
|
||||
|
||||
$active_tab = UM()->profile()->active_tab();
|
||||
//check here tabs with hidden also, to make correct check of active tab
|
||||
if ( ! isset( $all_tabs[ $active_tab ] ) ) {
|
||||
if ( ! isset( $all_tabs[ $active_tab ] ) || um_is_on_edit_profile() ) {
|
||||
$active_tab = 'main';
|
||||
UM()->profile()->active_tab = $active_tab;
|
||||
UM()->profile()->active_subnav = null;
|
||||
@@ -1446,7 +1457,7 @@ function um_profile_menu( $args ) {
|
||||
<a href="<?php echo esc_url( $nav_link ); ?>" class="uimob800-hide uimob500-hide uimob340-hide"
|
||||
title="<?php echo esc_attr( $tab['name'] ); ?>">
|
||||
|
||||
<?php if ( isset( $tab['notifier'] ) && $tab['notifier'] > 0) { ?>
|
||||
<?php if ( isset( $tab['notifier'] ) && $tab['notifier'] > 0 ) { ?>
|
||||
<span class="um-tab-notifier"><?php echo $tab['notifier']; ?></span>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ function um_logout_user_links( $args ) {
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?php echo esc_url( add_query_arg( 'redirect_to', UM()->permalinks()->get_current_url( true ), um_get_core_page( 'logout' ) ) ); ?>">
|
||||
<?php _e('Logout','ultimate-member'); ?>
|
||||
<?php _e( 'Logout', 'ultimate-member' ); ?>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user