admin管理员组文章数量:1316850
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 );
'
本文标签: how to add custom culomn to add user wordpress in plugin
版权声明:本文标题:how to add custom culomn to add user wordpress in plugin 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742011813a2413024.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论