Im trying to show the MD5 Password of the users as you see them in the database but in the users table as an extra column.
I have previusly done with the ID like this:
add_action( 'plugins_loaded', 'cmr_suid_execute' );
function cmr_suid_execute(){
add_filter('manage_users_columns', 'cmr_suid_add_uid_col');
function cmr_suid_add_uid_col($columns) {
$columns['user_id'] = 'ID';
return $columns;
}
add_action('manage_users_custom_column', 'cmr_suid_show_uid_col_data', 10, 3);
function cmr_suid_show_uid_col_data($value, $column_name, $user_id) {
$user = get_userdata( $user_id );
if ( 'user_id' == $column_name )
return $user_id;
return $value;
}
}
But I try this with the Passwords and it doesnt work... Am I missing something?
add_action( 'plugins_loaded', 'cmr_supwd_execute' );
function cmr_supwd_execute(){
add_filter('manage_users_columns', 'cmr_supwd_add_upwd_col');
function cmr_supwd_add_upwd_col($columns) {
$columns['user_pass'] = 'MD5 Password';
return $columns;
}
add_action('manage_users_custom_column', 'cmr_supwd_show_upwd_col_data', 10, 3);
function cmr_supwd_show_upwd_col_data($value, $column_name, $user_pass) {
$user = get_userdata( $user_pass );
if ( 'user_pass' == $column_name )
return $user_pass;
return $value;
}
}
Thanks in advance :)
get_userdata()
, this method only accepts the$user_id
as argument, not another column of the user. You could tryget_user_by()
instead, but this is a really bad idea because what if 2 users have the same password?