mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-20 15:13:55 +09:00
!!! IMPORTANT 2.0 version before upgrade please run full backup of your site !!!
- new code structure, optimized for next development; - created spl_autoloader for remove includes; - UM classes with namespaces; - deprecated global $ultimatemember; variable (use UM() instead); - new UM/WP roles logic; - new settings class and logic (deprecated Redux framework, deprecated some old options, added some new options); - new dependencies class for extensions; - WP native styles for backend fields; - new upgrades and license activations for extensions; - new logic form backend forms and fields; - created uninstall.php file for delete permanently all UM settings; - optimized registration/upgrade profile process; Deprecated Hooks: um_new_user_registration_plain um_user_registration_extra_hook um_add_user_frontend um_post_registration_global_hook um_admin_extend_directory_options_general (was action...will be filter)
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Processes the requests of UM actions
|
||||
*/
|
||||
add_action('init','um_action_request_process', 10);
|
||||
function um_action_request_process(){
|
||||
if ( is_admin() ) return false;
|
||||
if ( ! is_user_logged_in() ) return false;
|
||||
if ( ! isset( $_REQUEST['um_action'] ) ) return false;
|
||||
if ( isset( $_REQUEST['uid'] ) && ! UM()->user()->user_exists_by_id( $_REQUEST['uid'] ) ) return false;
|
||||
|
||||
if ( isset( $_REQUEST['uid'] ) ) {
|
||||
if ( is_super_admin( $_REQUEST['uid'] ) )
|
||||
wp_die( __( 'Super administrators can not be modified.','ultimate-member' ) );
|
||||
}
|
||||
|
||||
if ( isset( $_REQUEST['um_action'] ) && $_REQUEST['um_action'] != "edit" && ! current_user_can( 'edit_users' ) ){
|
||||
wp_die( __( 'You do not have enough permissions to do that.','ultimate-member') );
|
||||
}
|
||||
|
||||
if ( isset($_REQUEST['uid'])){
|
||||
$uid = $_REQUEST['uid'];
|
||||
}
|
||||
|
||||
switch( $_REQUEST['um_action'] ) {
|
||||
|
||||
default:
|
||||
$uid = ( isset( $_REQUEST['uid'] ) ) ? $_REQUEST['uid'] : 0;
|
||||
do_action('um_action_user_request_hook', $_REQUEST['um_action'], $uid);
|
||||
break;
|
||||
|
||||
case 'edit':
|
||||
UM()->fields()->editing = true;
|
||||
if ( !um_can_edit_my_profile() ) {
|
||||
$url = um_edit_my_profile_cancel_uri();
|
||||
exit( wp_redirect( $url ) );
|
||||
}
|
||||
break;
|
||||
|
||||
case 'um_switch_user':
|
||||
if ( !current_user_can('delete_users') ) return;
|
||||
UM()->user()->auto_login( $_REQUEST['uid'] );
|
||||
exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
|
||||
break;
|
||||
|
||||
case 'um_reject_membership':
|
||||
um_fetch_user( $uid );
|
||||
UM()->user()->reject();
|
||||
exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
|
||||
break;
|
||||
|
||||
case 'um_approve_membership':
|
||||
case 'um_reenable':
|
||||
um_fetch_user( $uid );
|
||||
UM()->user()->approve();
|
||||
exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
|
||||
break;
|
||||
|
||||
case 'um_put_as_pending':
|
||||
um_fetch_user( $uid );
|
||||
UM()->user()->pending();
|
||||
exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
|
||||
break;
|
||||
|
||||
case 'um_resend_activation':
|
||||
um_fetch_user( $uid );
|
||||
UM()->user()->email_pending();
|
||||
exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
|
||||
break;
|
||||
|
||||
case 'um_deactivate':
|
||||
um_fetch_user( $uid );
|
||||
UM()->user()->deactivate();
|
||||
exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
|
||||
break;
|
||||
|
||||
case 'um_delete':
|
||||
if ( ! UM()->roles()->um_current_user_can( 'delete', $uid ) ) wp_die( __('You do not have permission to delete this user.','ultimate-member') );
|
||||
um_fetch_user( $uid );
|
||||
UM()->user()->delete();
|
||||
exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user