• I would like All Users” to show registration date and password in the Admin section, seems like something that would be common for Admins.

    Regards
    Drachsi

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter Drachsi

    (@drachsi)

    I hoped somebody had the answer. Seems that dates should be part of the standard requirement for user registration. Anybody got an idea?

    Drachsi

    To show user registration date column in the users table, use something like this:

    add_filter('manage_users_columns', 'user_registration_date_column');
    function user_registration_date_column($columns) {
        $columns['user_registered'] = 'User Registered';
        return $columns;
    }
    
    add_action('manage_users_custom_column',  'user_registration_date', 10, 3);
    function user_registration_date($value, $column_name, $user_id) {
        $user = get_userdata( $user_id );
    	if ( 'user_registered' == $column_name ) {
    		$datetime =  $user->user_registered;
    		$date = strtotime($datetime);
    		return  date( "Y-m-d", $date );
    	}
        return $value;
    }

    Thread Starter Drachsi

    (@drachsi)

    Please could you confirm which file and where I should add it.

    Regards
    Drachsi

    Insert the codes in your theme’s functions.php file…

    Thread Starter Drachsi

    (@drachsi)

    Brilliant. That worked, would it be possible to add the password field as well?
    Sorry at nearly 74 it all takes a little longer.

    Drachsi

    Thread Starter Drachsi

    (@drachsi)

    Sorry to ask but I can sort “User Name” and “Email” but not date. Is this possible?

    Regards
    Drachsi

    OK…to make the date column sortable add the following code also in your functions.php file:

    function registration_date_column_register_sortable( $columns ) {
    	$columns['user_registered'] = 'user_registered';
    	return $columns;
    }
    add_filter( 'manage_users_sortable_columns', 'registration_date_column_register_sortable' );

    Now concerning adding the password column. The password field value on the db cannot be converted into plain text, as wordpress uses a 1 way encryption to store the passwords using a variation of md5 that cannot be reserved. That is why a new password is generated when a previous one is lost. And this is done on purpose so admins can’t have access to their users passwords,as some users are using the same password on different accounts.

    However, there are some sites that claims to do MD5 reserve lookup, I think is more of a hacker tool.

    Thread Starter Drachsi

    (@drachsi)

    Hi,

    When I added that after the earlier code, I got an error message.
    “Parse error: syntax error, unexpected ‘&’, expecting ‘]’ in /home/xxxx/public_html/xxxx.com/wp-content/themes/xxxx/functions.php on line 300”

    I will forget the password requirement, what you said makes a lot of sense.

    Regards

    Drachsi

    Parse error: syntax error, unexpected ‘&’, expecting ‘]’ in …

    The codes I gave you has no ‘&’ character, I think the issue must be from your end as you try to insert the codes in your functions.php. Insert the whole stuff at the bottom of the file. The codes are working on my end without errors. If you are getting the error still, then we can insert the whole stuff inside a simple plugin for you, so you won’t have to edit the file yourself.

    Thread Starter Drachsi

    (@drachsi)

    I tried again and now it works. Many thanks.

    I really appreciate you taking the time to help.
    Have a great day.

    Regards

    Drachsi

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Can I add fields to the standard WP "All Users"?’ is closed to new replies.