Code a different kind of reporter-only setting

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
bitmaster
Posts: 2
Joined: 11 Oct 2005, 12:16

Code a different kind of reporter-only setting

Post by bitmaster »

What I want is that the reporters do not only see the bugs they reported theirselves, but also the bugs whereof a customized field (ID 6) of the bug matches the reporter's realname field.

I thought I'd give it a try and changed this in bug_api.php:


function bug_is_user_reporter( $p_bug_id, $p_user_id ) {
if ( bug_get_field( $p_bug_id, 'reporter_id' ) == $p_user_id ) {
return true;
} else {
return false;
}
}

******* To this: *******

function bug_is_user_reporter( $p_bug_id, $p_user_id ) {
if ( bug_get_field( $p_bug_id, 'reporter_id' ) == $p_user_id ) {
return true;
} else {
$query = "SELECT realname FROM mantis_user_table WHERE id='$p_user_id' LIMIT 1";
$result = mysql_query($query);
$user_regel = mysql_fetch_array($result);

$query = "SELECT value FROM mantis_custom_field_string_table WHERE bug_id='$p_bug_id' AND field_id='6' LIMIT 1";
$result = mysql_query($query);
$bug_regel = mysql_fetch_array($result);

if (($bug_regel['value'] == $user_regel['realname']) && (strlen($bug_regel['value']) > 0)) {
return true;
} else {
return false;
}
}
}


I know it would be cheap to do it like this, if it would work. But it doesn't. I tested the code itself, that works. I bet I have to do it an entirely different way. Or alter other functions too. Can someone help me out, or at least point me to the right direction? I upgraded to version 1.0.0rc2.
Post Reply