I want to add a custom column called balance for each user and I want to be able to update this column by adding value or subtracting value from it, and I want to do that by a plugin I create, any ideas ??
I used this code but the balance field doesn't show when I want to add a new user
'<?php
/**
* Plugin Name: add_col
* Description : plugin adds new column to user info
*/
function new_contact_methods( $contactmethods ) {
$contactmethods['balance'] = 'balance';
return $contactmethods;
}
add_filter( 'user_contactmethods', 'new_contact_methods', 10, 1 );
function new_modify_user_table( $column ) {
$column['balance'] = 'balance';
return $column;
}
add_filter( 'manage_users_columns', 'new_modify_user_table' );
function new_modify_user_table_row( $val, $column_name, $user_id ) {
switch ($column_name) {
case 'balance' :
return get_the_author_meta( 'balance', $user_id );
default:
}
return $val;
}
add_filter( 'manage_users_custom_column', 'new_modify_user_table_row', 10, 3 );
'