mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
- fixed delete user account;
- fixed upgrade scripts; - fixed tooltip scripts;
This commit is contained in:
@@ -156,7 +156,7 @@ a.um-delete{ color: #a00; }
|
|||||||
.ui-tooltip.um_tooltip {
|
.ui-tooltip.um_tooltip {
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
color: #eeeeee !important;
|
color: #eeeeee !important;
|
||||||
background-color: #333 !important;
|
background: #333 !important;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 1000000;
|
z-index: 1000000;
|
||||||
max-width: 300px;
|
max-width: 300px;
|
||||||
|
|||||||
@@ -29,12 +29,21 @@ UM()->options()->update( 'restricted_access_taxonomy_metabox', $all_taxonomies )
|
|||||||
|
|
||||||
$roles_array = UM()->roles()->get_roles( false, array( 'administrator' ) );
|
$roles_array = UM()->roles()->get_roles( false, array( 'administrator' ) );
|
||||||
|
|
||||||
$posts = get_posts( array(
|
/*$posts = get_posts( array(
|
||||||
'post_type' => 'any',
|
'post_type' => 'any',
|
||||||
'meta_key' => '_um_custom_access_settings',
|
'meta_key' => '_um_custom_access_settings',
|
||||||
'meta_value' => '1',
|
'meta_value' => '1',
|
||||||
'fields' => 'ids',
|
'fields' => 'ids',
|
||||||
'numberposts' => -1
|
'numberposts' => -1
|
||||||
|
) );*/
|
||||||
|
|
||||||
|
$p_query = new WP_Query;
|
||||||
|
$posts = $p_query->query( array(
|
||||||
|
'post_type' => 'any',
|
||||||
|
'meta_key' => '_um_custom_access_settings',
|
||||||
|
'meta_value' => '1',
|
||||||
|
'posts_per_page' => -1,
|
||||||
|
'fields' => 'ids'
|
||||||
) );
|
) );
|
||||||
|
|
||||||
if ( ! empty( $posts ) ) {
|
if ( ! empty( $posts ) ) {
|
||||||
|
|||||||
@@ -154,11 +154,19 @@ function um_upgrade_update_forum_per_page20beta1() {
|
|||||||
|
|
||||||
$roles_associations = get_option( 'um_roles_associations' );
|
$roles_associations = get_option( 'um_roles_associations' );
|
||||||
|
|
||||||
$bb_forums = get_posts( array(
|
/*$bb_forums = get_posts( array(
|
||||||
'post_type' => 'forum',
|
'post_type' => 'forum',
|
||||||
'paged' => $_POST['page'],
|
'paged' => $_POST['page'],
|
||||||
'numberposts' => $posts_per_page,
|
'numberposts' => $posts_per_page,
|
||||||
'fields' => 'ids'
|
'fields' => 'ids'
|
||||||
|
) );*/
|
||||||
|
|
||||||
|
$p_query = new WP_Query;
|
||||||
|
$bb_forums = $p_query->query( array(
|
||||||
|
'post_type' => 'forum',
|
||||||
|
'paged' => $_POST['page'],
|
||||||
|
'posts_per_page' => $posts_per_page,
|
||||||
|
'fields' => 'ids'
|
||||||
) );
|
) );
|
||||||
|
|
||||||
foreach ( $bb_forums as $forum_id ) {
|
foreach ( $bb_forums as $forum_id ) {
|
||||||
@@ -215,13 +223,20 @@ function um_upgrade_update_products_per_page20beta1() {
|
|||||||
|
|
||||||
$roles_associations = get_option( 'um_roles_associations' );
|
$roles_associations = get_option( 'um_roles_associations' );
|
||||||
|
|
||||||
$wc_products = get_posts( array(
|
/*$wc_products = get_posts( array(
|
||||||
'post_type' => 'product',
|
'post_type' => 'product',
|
||||||
'numberposts' => $posts_per_page,
|
'numberposts' => $posts_per_page,
|
||||||
'paged' => $_POST['page'],
|
'paged' => $_POST['page'],
|
||||||
'fields' => 'ids'
|
'fields' => 'ids'
|
||||||
) );
|
) );*/
|
||||||
|
|
||||||
|
$p_query = new WP_Query;
|
||||||
|
$wc_products = $p_query->query( array(
|
||||||
|
'post_type' => 'product',
|
||||||
|
'paged' => $_POST['page'],
|
||||||
|
'posts_per_page' => $posts_per_page,
|
||||||
|
'fields' => 'ids'
|
||||||
|
) );
|
||||||
|
|
||||||
foreach ( $wc_products as $product_id ) {
|
foreach ( $wc_products as $product_id ) {
|
||||||
$woo_product_role = get_post_meta( $product_id, '_um_woo_product_role', true );
|
$woo_product_role = get_post_meta( $product_id, '_um_woo_product_role', true );
|
||||||
|
|||||||
@@ -1,10 +1,17 @@
|
|||||||
<?php
|
<?php
|
||||||
$roles_associations = get_option( 'um_roles_associations' );
|
$roles_associations = get_option( 'um_roles_associations' );
|
||||||
|
|
||||||
$mc_lists = get_posts( array(
|
/*$mc_lists = get_posts( array(
|
||||||
'post_type' => 'um_mailchimp',
|
'post_type' => 'um_mailchimp',
|
||||||
'numberposts' => -1,
|
'numberposts' => -1,
|
||||||
'fields' => 'ids'
|
'fields' => 'ids'
|
||||||
|
) );*/
|
||||||
|
|
||||||
|
$p_query = new WP_Query;
|
||||||
|
$mc_lists = $p_query->query( array(
|
||||||
|
'post_type' => 'um_mailchimp',
|
||||||
|
'posts_per_page' => -1,
|
||||||
|
'fields' => 'ids'
|
||||||
) );
|
) );
|
||||||
|
|
||||||
foreach ( $mc_lists as $list_id ) {
|
foreach ( $mc_lists as $list_id ) {
|
||||||
|
|||||||
@@ -1,10 +1,17 @@
|
|||||||
<?php
|
<?php
|
||||||
$roles_associations = get_option( 'um_roles_associations' );
|
$roles_associations = get_option( 'um_roles_associations' );
|
||||||
|
|
||||||
$um_social_login = get_posts( array(
|
/*$um_social_login = get_posts( array(
|
||||||
'post_type' => 'um_social_login',
|
'post_type' => 'um_social_login',
|
||||||
'numberposts' => -1,
|
'numberposts' => -1,
|
||||||
'fields' => 'ids'
|
'fields' => 'ids'
|
||||||
|
) );*/
|
||||||
|
|
||||||
|
$p_query = new WP_Query;
|
||||||
|
$um_social_login = $p_query->query( array(
|
||||||
|
'post_type' => 'um_social_login',
|
||||||
|
'posts_per_page' => -1,
|
||||||
|
'fields' => 'ids'
|
||||||
) );
|
) );
|
||||||
|
|
||||||
foreach ( $um_social_login as $social_login_id ) {
|
foreach ( $um_social_login as $social_login_id ) {
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ $old_options = get_option( 'um_options' );
|
|||||||
add_option( 'um_options_backup20', $old_options );
|
add_option( 'um_options_backup20', $old_options );
|
||||||
|
|
||||||
$forms_query = new WP_Query;
|
$forms_query = new WP_Query;
|
||||||
|
|
||||||
$registration_forms = $forms_query->query( array(
|
$registration_forms = $forms_query->query( array(
|
||||||
'post_type' => 'um_form',
|
'post_type' => 'um_form',
|
||||||
'meta_query' => array(
|
'meta_query' => array(
|
||||||
@@ -27,35 +26,38 @@ $registration_forms = $forms_query->query( array(
|
|||||||
)
|
)
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
'posts_per_page' => -1,
|
||||||
'fields' => 'ids'
|
'fields' => 'ids'
|
||||||
) );
|
) );
|
||||||
|
|
||||||
$forms_query = new WP_Query;
|
$forms_query = new WP_Query;
|
||||||
$login_forms = $forms_query->query( array(
|
$login_forms = $forms_query->query( array(
|
||||||
'post_type' => 'um_form',
|
'post_type' => 'um_form',
|
||||||
'meta_query' => array(
|
'meta_query' => array(
|
||||||
'relation' => 'AND',
|
'relation' => 'AND',
|
||||||
array(
|
array(
|
||||||
'key' => '_um_mode',
|
'key' => '_um_mode',
|
||||||
'value' => 'login'
|
'value' => 'login'
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'relation' => 'OR',
|
'relation' => 'OR',
|
||||||
array(
|
array(
|
||||||
'key' => '_um_login_use_globals',
|
'key' => '_um_login_use_globals',
|
||||||
'compare' => 'NOT EXISTS'
|
'compare' => 'NOT EXISTS'
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'key' => '_um_login_use_globals',
|
'key' => '_um_login_use_globals',
|
||||||
'value' => true,
|
'value' => true,
|
||||||
'compare' => '!='
|
'compare' => '!='
|
||||||
)
|
)
|
||||||
),
|
|
||||||
|
|
||||||
),
|
),
|
||||||
'fields' => 'ids'
|
|
||||||
) );
|
|
||||||
|
|
||||||
|
),
|
||||||
|
'posts_per_page' => -1,
|
||||||
|
'fields' => 'ids'
|
||||||
|
) );
|
||||||
|
|
||||||
|
$forms_query = new WP_Query;
|
||||||
$profile_forms = $forms_query->query( array(
|
$profile_forms = $forms_query->query( array(
|
||||||
'post_type' => 'um_form',
|
'post_type' => 'um_form',
|
||||||
'meta_query' => array(
|
'meta_query' => array(
|
||||||
@@ -77,6 +79,7 @@ $profile_forms = $forms_query->query( array(
|
|||||||
)
|
)
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
'posts_per_page' => -1,
|
||||||
'fields' => 'ids'
|
'fields' => 'ids'
|
||||||
) );
|
) );
|
||||||
|
|
||||||
|
|||||||
@@ -5,10 +5,11 @@ $roles_associations = get_option( 'um_roles_associations' );
|
|||||||
//"use_global" meta change to "_use_custom_settings"
|
//"use_global" meta change to "_use_custom_settings"
|
||||||
|
|
||||||
//also update for forms metadata where "member" or "admin"
|
//also update for forms metadata where "member" or "admin"
|
||||||
$forms = get_posts( array(
|
$forms_query = new WP_Query;
|
||||||
'post_type' => 'um_form',
|
$forms = $forms_query->query( array(
|
||||||
'numberposts' => -1,
|
'post_type' => 'um_form',
|
||||||
'fields' => 'ids'
|
'posts_per_page' => -1,
|
||||||
|
'fields' => 'ids'
|
||||||
) );
|
) );
|
||||||
|
|
||||||
foreach ( $forms as $form_id ) {
|
foreach ( $forms as $form_id ) {
|
||||||
@@ -30,10 +31,11 @@ foreach ( $forms as $form_id ) {
|
|||||||
|
|
||||||
//for metadata for all UM Member Directories
|
//for metadata for all UM Member Directories
|
||||||
//also update for forms metadata where "member" or "admin"
|
//also update for forms metadata where "member" or "admin"
|
||||||
$member_directories = get_posts( array(
|
$forms_query = new WP_Query;
|
||||||
'post_type' => 'um_directory',
|
$member_directories = $forms_query->query( array(
|
||||||
'numberposts' => -1,
|
'post_type' => 'um_directory',
|
||||||
'fields' => 'ids'
|
'posts_per_page' => -1,
|
||||||
|
'fields' => 'ids'
|
||||||
) );
|
) );
|
||||||
|
|
||||||
foreach ( $member_directories as $directory_id ) {
|
foreach ( $member_directories as $directory_id ) {
|
||||||
|
|||||||
@@ -280,6 +280,24 @@ if ( ! class_exists( 'um\core\Roles_Capabilities' ) ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove user role
|
||||||
|
*
|
||||||
|
* @param $user_id
|
||||||
|
* @param $role
|
||||||
|
*/
|
||||||
|
function set_role_wp( $user_id, $role ) {
|
||||||
|
// Validate user id
|
||||||
|
$user = get_userdata( $user_id );
|
||||||
|
|
||||||
|
// User exists
|
||||||
|
if ( ! empty( $user ) ) {
|
||||||
|
// Remove role
|
||||||
|
$user->add_role( $role );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set roles to user (remove all previous roles)
|
* Set roles to user (remove all previous roles)
|
||||||
* make user only with $roles roles
|
* make user only with $roles roles
|
||||||
|
|||||||
@@ -162,39 +162,37 @@ function um_submit_account_details( $args ) {
|
|||||||
|
|
||||||
if ( 'delete' == $current_tab && isset( $_POST['single_user_password'] ) && wp_check_password( $_POST['single_user_password'], $user->data->user_pass, $user->data->ID ) ) {
|
if ( 'delete' == $current_tab && isset( $_POST['single_user_password'] ) && wp_check_password( $_POST['single_user_password'], $user->data->user_pass, $user->data->ID ) ) {
|
||||||
if ( current_user_can( 'delete_users' ) || um_user( 'can_delete_profile' ) ) {
|
if ( current_user_can( 'delete_users' ) || um_user( 'can_delete_profile' ) ) {
|
||||||
if ( ! um_user( 'super_admin' ) ) {
|
UM()->user()->delete();
|
||||||
UM()->user()->delete();
|
|
||||||
|
|
||||||
if ( um_user( 'after_delete' ) && um_user( 'after_delete' ) == 'redirect_home' ) {
|
if ( um_user( 'after_delete' ) && um_user( 'after_delete' ) == 'redirect_home' ) {
|
||||||
um_redirect_home();
|
um_redirect_home();
|
||||||
} elseif ( um_user( 'delete_redirect_url' ) ) {
|
} elseif ( um_user( 'delete_redirect_url' ) ) {
|
||||||
/**
|
/**
|
||||||
* UM hook
|
* UM hook
|
||||||
*
|
*
|
||||||
* @type filter
|
* @type filter
|
||||||
* @title um_delete_account_redirect_url
|
* @title um_delete_account_redirect_url
|
||||||
* @description Change redirect URL after delete account
|
* @description Change redirect URL after delete account
|
||||||
* @input_vars
|
* @input_vars
|
||||||
* [{"var":"$url","type":"string","desc":"Redirect URL"},
|
* [{"var":"$url","type":"string","desc":"Redirect URL"},
|
||||||
* {"var":"$id","type":"int","desc":"User ID"}]
|
* {"var":"$id","type":"int","desc":"User ID"}]
|
||||||
* @change_log
|
* @change_log
|
||||||
* ["Since: 2.0"]
|
* ["Since: 2.0"]
|
||||||
* @usage
|
* @usage
|
||||||
* <?php add_filter( 'um_delete_account_redirect_url', 'function_name', 10, 2 ); ?>
|
* <?php add_filter( 'um_delete_account_redirect_url', 'function_name', 10, 2 ); ?>
|
||||||
* @example
|
* @example
|
||||||
* <?php
|
* <?php
|
||||||
* add_filter( 'um_delete_account_redirect_url', 'my_delete_account_redirect_url', 10, 2 );
|
* add_filter( 'um_delete_account_redirect_url', 'my_delete_account_redirect_url', 10, 2 );
|
||||||
* function my_delete_account_redirect_url( $url, $id ) {
|
* function my_delete_account_redirect_url( $url, $id ) {
|
||||||
* // your code here
|
* // your code here
|
||||||
* return $url;
|
* return $url;
|
||||||
* }
|
* }
|
||||||
* ?>
|
* ?>
|
||||||
*/
|
*/
|
||||||
$redirect_url = apply_filters( 'um_delete_account_redirect_url', um_user( 'delete_redirect_url' ), um_user( 'ID' ) );
|
$redirect_url = apply_filters( 'um_delete_account_redirect_url', um_user( 'delete_redirect_url' ), um_user( 'ID' ) );
|
||||||
exit( wp_redirect( $redirect_url ) );
|
exit( wp_redirect( $redirect_url ) );
|
||||||
} else {
|
} else {
|
||||||
um_redirect_home();
|
um_redirect_home();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user