0

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

0

This 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 );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.