<?php

class ACCJ_Role_Service {

    public function get_user_roles($user_id){

        global $wpdb;

        $sql = "
        SELECT r.*
        FROM {$wpdb->prefix}accj_roles r
        JOIN {$wpdb->prefix}accj_user_roles ur
        ON ur.role_id = r.id
        WHERE ur.user_id = %d
        AND r.is_active = 1
        ";

        return $wpdb->get_results(
            $wpdb->prepare($sql,$user_id),
            ARRAY_A
        );
    }

}
