• Hi
    sorry to be asking this (and others have asked but i don’t understand their answers.
    I have a database query that works in my ugly table plugin but i cant work out how to get it to replace your data example especially as i have some additional work done to the results (my columns are: title, count, user, group – i have changed all your example data and code to work with this).
    `$result = $wpdb->get_results( “SELECT r1.user_id, r1.product_id, r1.download_count, r2.group_id, r3.name
    FROM l3x_woocommerce_downloadable_product_permissions r1
    JOIN l3x_groups_user_group r2 ON r1.user_id = r2.user_id
    JOIN l3x_groups_group r3 ON r2.group_id = r3.group_id
    WHERE r2.group_id != 1
    “);

    /* Convert User ID to User Login $row->user_id. */
    $userid = $row->user_id;
    $user_info = get_userdata( $userid );
    $user = $user_info->user_login;

    /* Convert Product ID to Product Title (a Product is a Post) $row->product_id */
    $ID = $row->product_id;
    $title = get_the_title( $ID );

    $group = $row->name;

    $count = $row->download_count;

    https://wordpress.org/plugins/custom-list-table-example/

  • The topic ‘How to add query to replace example data?’ is closed to new replies.