function to list users in a quota

blindmime
@blindmime
9 years ago
772 posts
I the Issue Tracker module the dropdown list to assign possible users to assign is filled with the jrTracker_get_profile_users function. I would like to change this to a list of all users in a specific quota.
updated by @blindmime: 03/18/16 10:15:41PM
SteveX
SteveX
@ultrajam
9 years ago
2,584 posts
Theres docs here which might help:
https://www.jamroom.net/ultrajam/documentation/code/1643/how-to-use-livesearch-in-your-module


--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)
blindmime
@blindmime
9 years ago
772 posts
I'm not looking for a live search. The function above sits in the option field in the form designer. Is there a function that will populate the dropdown with users from a specific quota? Is the a doc with a list of available functions that we can use in this fashion?
michael
@michael
9 years ago
7,715 posts
That function is found in include.php about line 580 ish. It looks like this:
/**
 * Get all users that belong to a profile for ticket owner
 * @return mixed
 */
function jrTracker_get_profile_users(){
    global $_user, $_post;
    if (isset($_post['profile_id']) && jrCore_checktype($_post['profile_id'], 'number_nz')) {
        $profile_id = $_post['profile_id'];
    }
    else {
        $profile_id = $_user['user_active_profile_id'];
    }
    $tb1 = jrCore_db_table_name('jrProfile', 'profile_link');
    $tb2 = jrCore_db_table_name('jrUser', 'item_key');
    $req = "SELECT u.`value` FROM {$tb1} p LEFT JOIN {$tb2} u ON (u.`_item_id` = p.user_id AND u.`key` = 'user_name') WHERE p.profile_id = '{$profile_id}' ORDER BY u.`value` ASC";
    $_us = jrCore_db_query($req, 'value', false, 'value');
    if ($_us && is_array($_us)) {
        $_ln = jrUser_load_lang_strings();
        $_us['unassigned'] = $_ln['jrTracker'][72];
        return $_us;
    }
    return false;
}

You could use that as the base for a function you write yourself in a simple module.

Tags