php - How to handle user_row_actions in WordPress? -
first of all, have not find solution problem. have read few articles , thread create user actions , , tried following code.
function kv_admin_deactivate_link($actions, $user_object) { $actions['deactivate_user'] = "<a href='" . admin_url( "users.php?action=deactivate&user=$user_object->id") . "'>" . __( 'deactivate', 'kvc' ) . "</a>"; return $actions; } add_filter('user_row_actions', 'kv_admin_deactivate_link', 10, 2);
after using above code gets me additional action users list in below screenshot.
now, problem is, don't know how proceed write codes deactivate user. can me write function handle /wp-admin/users.php?action=deactivate&user=41
. here writing these function wordpress theme , how can write function it.
this perform deactivate operation function. create admin menu following code.
function xxxadmin_submenu_email() { add_menu_page('your menu', 'your menu', 'manage_options', 'deactivate' , 'xxx_deactivate_functions', '', 66); } add_action('admin_menu', 'xxxadmin_submenu_email');
now, page , have write function inside xxx_deactivate_functions
it. here sample code.
function xxx_deactivate_functions() { if(isset($_get['action']) && $_get['action']== 'deactivate'){ $user_id = $_get['user']; $user_info = get_userdata($user_id); } }
and have modified function below one.
function kv_admin_deactivate_link($actions, $user_object) { $actions['deactivate_user'] = "<a href='" . admin_url( "users.php?page=deactivate&action=deactivate&user=$user_object->id") . "'>" . __( 'deactivate', 'kvc' ) . "</a>"; return $actions; } add_filter('user_row_actions', 'kv_admin_deactivate_link', 10, 2);
this 1 way this. wait other experts solution code better way. hope helpful urgent need.
Comments
Post a Comment