admin管理员组文章数量:1125625
I wan to add a date field to my user list dashboard where I can see list of new subscribers to my website along with the date they signed-up.
Thanks ~Vik
I wan to add a date field to my user list dashboard where I can see list of new subscribers to my website along with the date they signed-up.
Thanks ~Vik
Share Improve this question asked Jan 14, 2017 at 23:30 VikVik 11 bronze badge1 Answer
Reset to default 1This should be it
<?php
function new_contact_methods( $contactmethods ) {
$contactmethods['signupdate'] = 'Date';
return $contactmethods;
}
add_filter( 'user_contactmethods', 'new_contact_methods', 10, 1 );
function new_modify_user_table( $column ) {
$column['signupdate'] = 'Date';
return $column;
}
add_filter( 'manage_users_columns', 'new_modify_user_table' );
function new_modify_user_table_row( $val, $column_name, $user_id ) {
$user = get_user_by( 'id', $user_id );
$date_formatted = new DateTime($user->user_registered);
switch ($column_name) {
case 'signupdate' :
// return date_format($date_formatted, 'Y-m-d H:i:s');
return $date_formatted->format('Y-m-d');
break;
default:
}
return $val;
}
add_filter( 'manage_users_custom_column', 'new_modify_user_table_row', 10, 3 );
本文标签: Add custom Date column to quotAll Usersquot admin panel in WP
版权声明:本文标题:Add custom Date column to "All Users" admin panel in WP 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736622463a1945605.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论