mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-11 18:56:10 +09:00
- removed procedural methods;
This commit is contained in:
@@ -31,7 +31,71 @@ if ( ! class_exists( 'um\admin\core\Admin_Users' ) ) {
|
||||
|
||||
add_filter( 'views_users', array( &$this, 'add_status_links' ) );
|
||||
|
||||
add_action( 'admin_init', array( &$this, 'um_bulk_users_edit' ), 9 );
|
||||
add_action( 'admin_init', array( &$this, 'um_bulk_users_edit' ), 9 );
|
||||
|
||||
add_action( 'um_admin_user_action_hook', array( &$this, 'user_action_hook' ), 10, 1 );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Does an action to user asap
|
||||
*
|
||||
* @param string $action
|
||||
*/
|
||||
function user_action_hook( $action ) {
|
||||
switch ( $action ) {
|
||||
|
||||
default:
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type action
|
||||
* @title um_admin_custom_hook_{$action}
|
||||
* @description Integration hook on user action
|
||||
* @input_vars
|
||||
* [{"var":"$user_id","type":"int","desc":"User ID"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_action( 'um_admin_custom_hook_{$action}', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_action( 'um_admin_custom_hook_{$action}', 'my_admin_custom_hook', 10, 1 );
|
||||
* function my_admin_after_main_notices( $user_id ) {
|
||||
* // your code here
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
do_action( "um_admin_custom_hook_{$action}", UM()->user()->id );
|
||||
break;
|
||||
|
||||
case 'um_put_as_pending':
|
||||
UM()->user()->pending();
|
||||
break;
|
||||
|
||||
case 'um_approve_membership':
|
||||
case 'um_reenable':
|
||||
UM()->user()->approve();
|
||||
break;
|
||||
|
||||
case 'um_reject_membership':
|
||||
UM()->user()->reject();
|
||||
break;
|
||||
|
||||
case 'um_resend_activation':
|
||||
UM()->user()->email_pending();
|
||||
break;
|
||||
|
||||
case 'um_deactivate':
|
||||
UM()->user()->deactivate();
|
||||
break;
|
||||
|
||||
case 'um_delete':
|
||||
if ( is_admin() ) {
|
||||
wp_die( 'This action is not allowed in backend.', 'ultimate-member' );
|
||||
}
|
||||
UM()->user()->delete();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user