Okay
  Public Ticket #2437286
Users
Closed

Comments

  •  36
    Miss Fashion Week started the conversation

    How to change the columns of Users to show number of Products?  

    this is under 'users'

  •  2,636
    Kevin replied

    Hi Miss Fashion Week 

    This part is the back-end of the WP displaying related information and it does not yet support displaying number products here

    thank you

  •  36
    Miss Fashion Week replied

    Will show how many orders that the customer bought?

  •  36
    Miss Fashion Week replied

    How to sort users from old to new ..right now it's random

  •  2,636
    Kevin replied

    Hi Miss Fashion Week

    "Will show how many orders that the customer bought?"
    Please try leaving the support question on the Dokan plugin about supporting this not for details
    # refer to this document for more user arrangements
    https://rudrastyh.com/wordpress/sortable-date-user-registered-column.html

    thank you

  •  36
    Miss Fashion Week replied

    we copied the follow code into theme functions.  now the whole website down.


    /*

     * Create a column. And maybe remove some of the default ones

     * @param array $columns Array of all user table columns {column ID} => {column Name} 

     */

    add_filter( 'manage_users_columns', 'rudr_modify_user_table' );

     

    function rudr_modify_user_table( $columns ) {

     

    // unset( $columns['posts'] ); // maybe you would like to remove default columns

    $columns['registration_date'] = 'Registration date'; // add new

     

    return $columns;

     

    }

     

    /*

     * Fill our new column with the registration dates of the users

     * @param string $row_output text/HTML output of a table cell

     * @param string $column_id_attr column ID

     * @param int $user user ID (in fact - table row ID)

     */

    add_filter( 'manage_users_custom_column', 'rudr_modify_user_table_row', 10, 3 );

     

    function rudr_modify_user_table_row( $row_output, $column_id_attr, $user ) {

     

    $date_format = 'j M, Y H:i';

     

    switch ( $column_id_attr ) {

    case 'registration_date' :

    return date( $date_format, strtotime( get_the_author_meta( 'registered', $user ) ) );

    break;

    default:

    }

     

    return $row_output;

     

    }

     

    /*

     * Make our "Registration date" column sortable

     * @param array $columns Array of all user sortable columns {column ID} => {orderby GET-param} 

     */

    add_filter( 'manage_users_sortable_columns', 'rudr_make_registered_column_sortable' );

     

    function rudr_make_registered_column_sortable( $columns ) {

    return wp_parse_args( array( 'registration_date' => 'registered' ), $columns );

    }




  •   Miss Fashion Week replied privately
  •  36
    Miss Fashion Week replied

    recovered and deleted the code.

  •  2,636
    Kevin replied

    Hi Miss Fashion Week

    I added it in the functions.php file
    You can review it in the Users menu

    thank you