heading. * @return array */ public function add_column( $columns ) { $columns[ self::COLUMN ] = __( 'Registered', 'adminkeep' ); return $columns; } /** * Sort through the orderby WP_User_Query already understands. * * The second element is the first-click direction: descending, because the newest accounts * are the ones worth looking at. * * @param array $sortable Column key => sort definition. * @return array */ public function make_sortable( $sortable ) { $sortable[ self::COLUMN ] = array( 'registered', true ); return $sortable; } /** * The cell: the date, with the full moment on hover. * * @param string $output Output so far. * @param string $column Column key. * @param int $user_id User id. * @return string */ public function render_cell( $output, $column, $user_id ) { if ( self::COLUMN !== $column ) { return $output; } $user = get_userdata( $user_id ); // user_registered is stored in UTC. Some importers leave a zero date behind. $timestamp = $user ? strtotime( $user->user_registered . ' UTC' ) : false; if ( false === $timestamp || $timestamp <= 0 ) { return '—'; } $date_format = get_option( 'date_format' ); return sprintf( '%2$s', esc_attr( wp_date( $date_format . ' ' . get_option( 'time_format' ), $timestamp ) ), esc_html( wp_date( $date_format, $timestamp ) ) ); } }