mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-13 03:36:28 +09:00
Merge branch 'master' of https://github.com/ultimatemember/ultimatemember
This commit is contained in:
@@ -88,17 +88,15 @@ if ( ! class_exists( 'um\core\Enqueue' ) ) {
|
||||
wp_register_script( 'um_fileupload', $this->js_baseurl . 'um-fileupload' . $this->suffix . '.js', array( 'jquery', 'um_jquery_form' ), ultimatemember_version, true );
|
||||
|
||||
|
||||
$datetime_deps = array( 'jquery' );
|
||||
// load a localized version for date/time
|
||||
$locale = get_locale();
|
||||
if ( $locale && file_exists( um_path . 'assets/js/pickadate/translations/' . $locale . '.js' ) ) {
|
||||
wp_register_script('um_datetime_locale', um_url . 'assets/js/pickadate/translations/' . $locale . '.js', array( 'jquery' ), ultimatemember_version, true );
|
||||
$datetime_deps[] = 'um_datetime_locale';
|
||||
}
|
||||
wp_register_script( 'um_datetime', $this->js_baseurl . 'pickadate/picker.js', $datetime_deps, ultimatemember_version, true );
|
||||
wp_register_script( 'um_datetime', $this->js_baseurl . 'pickadate/picker.js', array( 'jquery' ), ultimatemember_version, true );
|
||||
wp_register_script( 'um_datetime_date', $this->js_baseurl . 'pickadate/picker.date.js', array( 'jquery', 'um_datetime' ), ultimatemember_version, true );
|
||||
wp_register_script( 'um_datetime_time', $this->js_baseurl . 'pickadate/picker.time.js', array( 'jquery', 'um_datetime' ), ultimatemember_version, true );
|
||||
wp_register_script( 'um_datetime_legacy', $this->js_baseurl . 'pickadate/legacy.js', array( 'jquery', 'um_datetime' ), ultimatemember_version, true );
|
||||
// load a localized version for date/time
|
||||
$locale = get_locale();
|
||||
if ( $locale && file_exists( um_path . 'assets/js/pickadate/translations/' . $locale . '.js' ) ) {
|
||||
wp_register_script('um_datetime_locale', um_url . 'assets/js/pickadate/translations/' . $locale . '.js', array( 'jquery', 'um_datetime' ), ultimatemember_version, true );
|
||||
}
|
||||
|
||||
wp_register_script( 'um_tipsy', $this->js_baseurl . 'um-tipsy' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, true );
|
||||
wp_register_script( 'um_raty', $this->js_baseurl . 'um-raty' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, true );
|
||||
@@ -110,7 +108,7 @@ if ( ! class_exists( 'um\core\Enqueue' ) ) {
|
||||
wp_register_script('um_functions', $this->js_baseurl . 'um-functions' . $this->suffix . '.js', array( 'jquery', 'jquery-masonry', 'wp-util', 'um_scrollbar' ), ultimatemember_version, true );
|
||||
wp_register_script( 'um-gdpr', $this->js_baseurl . 'um-gdpr' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, false );
|
||||
wp_register_script('um_conditional', $this->js_baseurl . 'um-conditional' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, true );
|
||||
wp_register_script('um_scripts', $this->js_baseurl . 'um-scripts' . $this->suffix . '.js', array( 'jquery', 'wp-util', 'um_conditional' ), ultimatemember_version, true );
|
||||
wp_register_script('um_scripts', $this->js_baseurl . 'um-scripts' . $this->suffix . '.js', array( 'jquery', 'wp-util', 'um_conditional', 'um_datetime', 'um_datetime_date', 'um_datetime_time', 'um_datetime_legacy' ), ultimatemember_version, true );
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
@@ -131,7 +129,9 @@ if ( ! class_exists( 'um\core\Enqueue' ) ) {
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$localize_data = apply_filters( 'um_enqueue_localize_data', array() );
|
||||
$localize_data = apply_filters( 'um_enqueue_localize_data', array(
|
||||
'nonce' => wp_create_nonce( "um-frontend-nonce" ),
|
||||
) );
|
||||
wp_localize_script( 'um_scripts', 'um_scripts', $localize_data );
|
||||
|
||||
wp_register_script('um_members', $this->js_baseurl . 'um-members' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, true );
|
||||
@@ -327,6 +327,13 @@ if ( ! class_exists( 'um\core\Enqueue' ) ) {
|
||||
wp_enqueue_script('um_datetime_date');
|
||||
wp_enqueue_script('um_datetime_time');
|
||||
wp_enqueue_script('um_datetime_legacy');
|
||||
|
||||
// load a localized version for date/time
|
||||
$locale = get_locale();
|
||||
if ( $locale && file_exists( um_path . 'assets/js/pickadate/translations/' . $locale . '.js' ) ) {
|
||||
wp_enqueue_script('um_datetime_locale' );
|
||||
}
|
||||
|
||||
wp_enqueue_style('um_datetime');
|
||||
wp_enqueue_style('um_datetime_date');
|
||||
wp_enqueue_style('um_datetime_time');
|
||||
|
||||
@@ -4096,21 +4096,25 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
*
|
||||
*/
|
||||
function do_ajax_action() {
|
||||
if (!is_user_logged_in() || !current_user_can( 'manage_options' )) die( __( 'Please login as administrator', 'ultimate-member' ) );
|
||||
UM()->admin()->check_ajax_nonce();
|
||||
|
||||
if ( ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) {
|
||||
wp_send_json_error( __( 'Please login as administrator', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
extract( $_POST );
|
||||
|
||||
$output = null;
|
||||
|
||||
$position = array();
|
||||
if (!empty( $in_column )) {
|
||||
if ( ! empty( $in_column ) ) {
|
||||
$position['in_row'] = '_um_row_' . ( (int)$in_row + 1 );
|
||||
$position['in_sub_row'] = $in_sub_row;
|
||||
$position['in_column'] = $in_column;
|
||||
$position['in_group'] = $in_group;
|
||||
}
|
||||
|
||||
switch ($act_id) {
|
||||
switch ( $act_id ) {
|
||||
|
||||
case 'um_admin_duplicate_field':
|
||||
$this->duplicate_field( $arg1, $arg2 );
|
||||
|
||||
@@ -81,11 +81,11 @@ if ( ! class_exists( 'um\core\Files' ) ) {
|
||||
$field_key = urlencode( $field_key );
|
||||
|
||||
if ( UM()->is_permalinks ) {
|
||||
$url = get_site_url( get_current_blog_id() );
|
||||
$url = get_home_url( get_current_blog_id() );
|
||||
$nonce = wp_create_nonce( $user_id . $form_id . 'um-download-nonce' );
|
||||
$url = $url . "/um-download/{$form_id}/{$field_key}/{$user_id}/{$nonce}";
|
||||
} else {
|
||||
$url = get_site_url( get_current_blog_id() );
|
||||
$url = get_home_url( get_current_blog_id() );
|
||||
$nonce = wp_create_nonce( $user_id . $form_id . 'um-download-nonce' );
|
||||
$url = add_query_arg( array( 'um_action' => 'download', 'um_form' => $form_id, 'um_field' => $field_key, 'um_user' => $user_id, 'um_verify' => $nonce ), $url );
|
||||
}
|
||||
@@ -241,7 +241,7 @@ if ( ! class_exists( 'um\core\Files' ) ) {
|
||||
* Remove file by AJAX
|
||||
*/
|
||||
function ajax_remove_file() {
|
||||
UM()->check_frontend_ajax_nonce();
|
||||
UM()->check_ajax_nonce();
|
||||
|
||||
/**
|
||||
* @var $src
|
||||
@@ -257,7 +257,7 @@ if ( ! class_exists( 'um\core\Files' ) ) {
|
||||
* Resize image AJAX handler
|
||||
*/
|
||||
function ajax_resize_image() {
|
||||
UM()->check_frontend_ajax_nonce();
|
||||
UM()->check_ajax_nonce();
|
||||
|
||||
/**
|
||||
* @var $key
|
||||
|
||||
@@ -50,6 +50,8 @@ if ( ! class_exists( 'um\core\Form' ) ) {
|
||||
*
|
||||
*/
|
||||
function ajax_muted_action() {
|
||||
UM()->check_ajax_nonce();
|
||||
|
||||
extract( $_REQUEST );
|
||||
|
||||
if ( ! UM()->roles()->um_current_user_can( 'edit', $user_id ) )
|
||||
@@ -86,7 +88,7 @@ if ( ! class_exists( 'um\core\Form' ) ) {
|
||||
*
|
||||
*/
|
||||
function ajax_select_options() {
|
||||
|
||||
UM()->check_ajax_nonce();
|
||||
|
||||
$arr_options = array();
|
||||
$arr_options['status'] = 'success';
|
||||
|
||||
@@ -45,6 +45,8 @@ if ( ! class_exists( 'um\core\Profile' ) ) {
|
||||
* Delete profile avatar AJAX handler
|
||||
*/
|
||||
function ajax_delete_profile_photo() {
|
||||
UM()->check_ajax_nonce();
|
||||
|
||||
/**
|
||||
* @var $user_id
|
||||
*/
|
||||
@@ -61,6 +63,8 @@ if ( ! class_exists( 'um\core\Profile' ) ) {
|
||||
* Delete cover photo AJAX handler
|
||||
*/
|
||||
function ajax_delete_cover_photo() {
|
||||
UM()->check_ajax_nonce();
|
||||
|
||||
/**
|
||||
* @var $user_id
|
||||
*/
|
||||
@@ -218,7 +222,7 @@ if ( ! class_exists( 'um\core\Profile' ) ) {
|
||||
*/
|
||||
function can_view_tab( $tab ) {
|
||||
|
||||
$target_id = UM()->user()->target_id;
|
||||
$target_id = (int) UM()->user()->target_id;
|
||||
if ( empty( $target_id ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -39,6 +39,8 @@ if ( ! class_exists( 'um\core\Query' ) ) {
|
||||
* Ajax pagination for posts
|
||||
*/
|
||||
function ajax_paginate() {
|
||||
UM()->check_ajax_nonce();
|
||||
|
||||
/**
|
||||
* @var $hook
|
||||
* @var $args
|
||||
|
||||
@@ -82,6 +82,8 @@ if ( ! class_exists( 'um\core\User_posts' ) ) {
|
||||
*
|
||||
*/
|
||||
function load_posts() {
|
||||
UM()->check_ajax_nonce();
|
||||
|
||||
$author = ! empty( $_POST['author'] ) ? $_POST['author'] : get_current_user_id();
|
||||
$page = ! empty( $_POST['page'] ) ? $_POST['page'] : 0;
|
||||
|
||||
|
||||
@@ -87,8 +87,11 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
|
||||
add_action( 'init', array( &$this, 'check_membership' ), 10 );
|
||||
|
||||
add_action( 'delete_user', array( &$this, 'delete_user_handler' ), 10, 1 );
|
||||
add_action( 'wpmu_delete_user', array( &$this, 'delete_user_handler' ), 10, 1 );
|
||||
if ( is_multisite() ) {
|
||||
add_action( 'delete_user', array( &$this, 'delete_user_handler' ), 10, 1 );
|
||||
} else {
|
||||
add_action( 'wpmu_delete_user', array( &$this, 'delete_user_handler' ), 10, 1 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -96,6 +99,8 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
* @param $user_id
|
||||
*/
|
||||
function delete_user_handler( $user_id ) {
|
||||
error_log( '----------------' );
|
||||
error_log( $user_id );
|
||||
|
||||
um_fetch_user( $user_id );
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
* @return boolean
|
||||
*/
|
||||
function ultimatemember_check_username_exists() {
|
||||
UM()->check_ajax_nonce();
|
||||
|
||||
$username = isset($_REQUEST['username']) ? $_REQUEST['username'] : '';
|
||||
$exists = username_exists( $username );
|
||||
|
||||
|
||||
@@ -12,33 +12,30 @@ function um_browser_url_redirect_to( $args ) {
|
||||
$url = '';
|
||||
|
||||
if ( ! empty( $_REQUEST['redirect_to'] ) ) {
|
||||
|
||||
$url = $_REQUEST['redirect_to'];
|
||||
echo '<input type="hidden" name="redirect_to" id="redirect_to" value="'.esc_url( $url ).'" />';
|
||||
|
||||
} elseif ( ! empty( $args['after_login'] ) ) {
|
||||
|
||||
|
||||
switch ( $args['after_login'] ) {
|
||||
|
||||
|
||||
case 'redirect_admin':
|
||||
$url = admin_url();
|
||||
break;
|
||||
|
||||
|
||||
case 'redirect_profile':
|
||||
$url = um_user_profile_url();
|
||||
break;
|
||||
|
||||
|
||||
case 'redirect_url':
|
||||
$url = $args['redirect_url'];
|
||||
break;
|
||||
|
||||
|
||||
case 'refresh':
|
||||
|
||||
$url = UM()->permalinks()->get_current_url();
|
||||
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -66,7 +63,6 @@ function um_browser_url_redirect_to( $args ) {
|
||||
if ( ! empty( $url ) ) {
|
||||
echo '<input type="hidden" name="redirect_to" id="redirect_to" value="' . esc_url( $url ) . '" />';
|
||||
}
|
||||
|
||||
}
|
||||
add_action( 'um_after_form_fields', 'um_browser_url_redirect_to' );
|
||||
|
||||
|
||||
@@ -888,9 +888,7 @@ function um_profile_header( $args ) {
|
||||
data-character-limit="<?php echo UM()->options()->get( 'profile_bio_maxchars' ); ?>"
|
||||
placeholder="<?php _e( 'Tell us a bit about yourself...', 'ultimate-member' ); ?>"
|
||||
name="<?php echo 'description-' . $args['form_id']; ?>"
|
||||
id="<?php echo 'description-' . $args['form_id']; ?>"><?php if (um_user( 'description' )) {
|
||||
echo um_user( 'description' );
|
||||
} ?></textarea>
|
||||
id="<?php echo 'description-' . $args['form_id']; ?>"><?php echo UM()->fields()->field_value( 'description' ) ?></textarea>
|
||||
<span class="um-meta-bio-character um-right"><span
|
||||
class="um-bio-limit"><?php echo UM()->options()->get( 'profile_bio_maxchars' ); ?></span></span>
|
||||
<?php
|
||||
|
||||
Reference in New Issue
Block a user