Hello! I need to delimit user rights on file downloading so that, for exsample, a user can download from one thread (category or theme) all files which he would like, but from another thread he can not dawnload any files and only can read posters. I think the solution to this problem is to add a condition on printing out of a link while the condition is true:

$allow_downloading = $forum_user['g_id'] == FORUM_ADMIN || $cur_topic['g_pun_attachment_allow_download'];

If we add a condition on chek of a thread, in which the user is, and then on chek of a group which member is the user, We will get a following list:

if (it's a condition of user belonging to the thread)
    {
    $allow_downloading = $forum_user['group_id'] == 5 || $forum_user['group_id'] == 1 && 

$cur_topic['g_pun_attachment_allow_download'];
    }
    else
    {
    $allow_downloading = $forum_user['g_id'] == FORUM_ADMIN || $cur_topic['g_pun_attachment_allow_download'];
    }

where
 

$forum_user['group_id'] == 5 || $forum_user['group_id'] == 1

is the condition of being in two groups of users, who can download files.

I have a quation: is it right method and in what variable can I find a current thread?