Making WordPress.org

Changeset 11622


Ignore:
Timestamp:
03/02/2022 06:40:41 AM (3 years ago)
Author:
dd32
Message:

Login: Pending user admin: Add colour highlighting to quickly scan accounts.

Experimenting, this might be too much and be removed.

Location:
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/admin/class-user-registrations-list-table.php

    r11289 r11622  
    189189
    190190        foreach ( $this->items as $i => $item ) {
    191             $this->items[$i]->user = $item->created ? get_user_by( 'slug', $item->user_login ) : false;
     191            $this->items[$i]->user       = $item->created ? get_user_by( 'slug', $item->user_login ) : false;
     192            $this->items[$i]->pending_id = (int) $this->items[$i]->pending_id;
     193            $this->items[$i]->cleared    = (int) $this->items[$i]->cleared;
     194            $this->items[$i]->created    = (int) $this->items[$i]->created;
     195            $this->items[$i]->meta       = json_decode( $this->items[$i]->meta );
     196            $this->items[$i]->scores     = json_decode( $this->items[$i]->scores );
    192197        }
    193198
     
    197202        ]);
    198203
     204    }
     205
     206    function single_row( $item ) {
     207        $classes = $this->get_row_class( $item );
     208        printf( '<tr class="%s">', esc_attr( implode( ' ', $classes ) ) );
     209        $this->single_row_columns( $item );
     210        echo '</tr>';
     211    }
     212
     213    function get_row_class( $item ) {
     214        $classes = [];
     215
     216        if ( ! empty( $_GET['view'] ) && 'all' !== $_GET['view'] ) {
     217            return $classes;
     218        }
     219
     220        if (
     221            $item->user &&
     222            'BLOCKED' === substr( $item->user->user_pass, 0, 7 )
     223        ) {
     224            $classes[] = 'blocked';
     225        } elseif ( $item->created ) {
     226            $classes[] = 'created';
     227        } elseif ( $item->cleared > 1 ) {
     228            $classes[] = 'manually-approved';
     229        } elseif ( $item->cleared ) {
     230            $classes[] = 'cleared';
     231        } else {
     232            $classes[] = 'failed';
     233        }
     234
     235        return $classes;
    199236    }
    200237
     
    236273
    237274        echo '<hr>';
     275
    238276        echo $this->link_to_search( $item->user_email );
    239277
     
    293331
    294332    function column_meta( $item ) {
    295         $meta = json_decode( $item->meta );
     333        $meta = $item->meta;
    296334
    297335        echo '<div>';
     
    310348            )
    311349        );
     350
    312351        echo '<hr>';
    313352
     
    333372        echo ( $item->cleared ? 'Passed' : 'Failed' ) . '<br>';
    334373
    335         foreach ( json_decode( $item->scores ) as $type => $val ) {
     374        foreach ( $item->scores as $type => $val ) {
    336375            printf(
    337376                '<abbr title="%s">%s</abbr> ',
     
    341380        }
    342381
    343         $meta    = json_decode( $item->meta );
    344         $akismet = $meta->akismet_result ?? '';
     382        $akismet = $item->meta->akismet_result ?? '';
    345383        if ( $akismet ) {
    346384            printf(
     
    351389        }
    352390
    353         $heuristics = $meta->heuristics ?? '';
     391        $heuristics = $item->meta->heuristics ?? '';
    354392        if ( $heuristics ) {
    355393            printf(
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/admin/ui.php

    r11620 r11622  
    8484            overflow: scroll;
    8585        }
     86        .wp-list-table.toplevel_page_user-registrations > tbody > tr.created {
     87            background-color: rgba(74, 202, 12, 0.06);
     88        }
     89        .wp-list-table.toplevel_page_user-registrations > tbody > tr.manually-approved {
     90            background-color: rgba(74, 202, 12, 0.12);
     91        }
     92        .wp-list-table.toplevel_page_user-registrations > tbody > tr.cleared {
     93            background-color: rgba(202, 181, 12, 0.06)
     94        }
     95        .wp-list-table.toplevel_page_user-registrations > tbody > tr.failed {
     96            background-color: rgba(202, 12, 12, 0.06)
     97        }
     98        .wp-list-table.toplevel_page_user-registrations > tbody > tr.blocked {
     99            background-color: rgba(202, 12, 12, 0.12)
     100        }
     101        .wp-list-table.toplevel_page_user-registrations > tbody td {
     102            border-bottom: 1px solid #cecece;
     103        }
     104        .wp-list-table.toplevel_page_user-registrations > tbody hr {
     105            opacity: 0.5;
     106        }
    86107    </style>
    87108    <?php
Note: See TracChangeset for help on using the changeset viewer.