Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Custom Button on users.php - ADMIN
- //add additional columns to the users.php admin page
- add_filter('manage_users_columns', 'activate_user_in_table');
- function activate_user_in_table( $column ){
- $column['active'] = 'Activeer';
- return $column;
- }
- add_filter('manage_users_custom_column', 'add_display_value', 50, 3);
- function add_display_value( $value, $column_name, $user_id ){
- $user = get_user_meta( $user_id );
- // Get the current status from the user.
- $value = $user['sophima_user_active'][0];
- // Based on the output 1 or 0 I have to create the button to activate or desactivate the user.
- switch ($value) {
- case 1 :
- $button = '<a href="'.add_query_arg(array('block' => '0','user_id' => $user_id)).'" name="display_as-'.$user_id.'" class="button green">Blokkeren</a>';
- return $button;
- break;
- case 0 :
- $button = '<a href="'.add_query_arg(array('activate' => '1','user_id' => $user_id)).'" name="display_as-'.$user_id.'" class="button green">Activeer</a>';
- update_usermeta($user_id, 'sophima_user_active', 0 );
- return $button;
- break;
- default:
- }
- return $value;
- }
- update_usermeta($user_id, 'sophima_user_active', 1 );
- update_usermeta($user_id, 'sophima_user_active', 1 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement