1

(5 replies, posted in PunBB 1.2 troubleshooting)

Problem solved! The query was ok... I had used $cur_forum as a variable name for a custom search box and the value of the original $cur_forum was lost smile Thanks!

2

(5 replies, posted in PunBB 1.2 troubleshooting)

I'm almost sure that the problem is here:

$result = $db->query('SELECT f.forum_name, f.redirect_url, f.moderators, f.num_topics, f.sort_by, fp.post_topics FROM '.$db->prefix.'forums AS f LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND f.id='.$id) or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error());

...but I can't understand this query (too little knowledge of SQL) sad

3

(5 replies, posted in PunBB 1.2 troubleshooting)

Nobody can help me?

4

(5 replies, posted in PunBB 1.2 troubleshooting)

Another problem is that when I want to edit a forum (in admin panel), the edit boxes are not populated with forum names and descriptions.

5

(5 replies, posted in PunBB 1.2 troubleshooting)

Hello,

Can somebody tell me how to make forum titles to be visible again. After modding, my forum doesn't show forum titles. To see what I mean, you can access www.vamist.com.

Thanks,
Stefan

I don't know if this it will be of any use, but I'll try to explain how the permissions are handled in PunBB. You will only have to excuse my poor english smile.
The default permissions are stored in the "groups" table (you can see the table structure here. For any group that you may have, you can assign rights (read, post, edit, delete, etc). Besides the group rights, you can assign forum rights that will override the group rights. Forum permissions are held in the "forum_perms" table (table structure). There, you can assign the rights that a group will have on a specific forum.
I hope that this will help you and that you will continue the work on punBB integration with your CMS!

Replace:

<?php /*if ($attach_allow_download)*/ echo "\t\t\t\t\t".'<div class="postsignature"><hr />'.$attach_output.'</div>'."\n"; ## Attachment Mod row ?>

with:

<?php if ($attach_num > 0) echo "\t\t\t\t\t".'<div class="postsignature"><hr />'.$attach_output.'</div>'."\n"; ## Attachment Mod row ?>

in order to fix a minor display BUG (my mistake)

Indeed, the only difference is the else statement.

P.S.: The code was very easy to understand 'cose is written very clean. Thank you for that! smile

Ok, a simple solution will be this one (FIRST OF ALL, MAKE A BACKUPS OF THE ORIGINAL viewtopic.php AND  lang/english/attach.php):

1. Open viewtopic.php
2. Replace:

    // Attachment Mod Block Start
    $attach_allow_download = false;
    $attach_output = '';
    $attach_num = 0;
    // Check if this post has any attachments
    $result_attach = $db->query('SELECT af.id, af.filename, af.size, af.downloads FROM '.$db->prefix.'attach_2_files AS af WHERE af.post_id='.$cur_post['id']) or error('Unable to fetch if there were any attachments to the post', __FILE__, __LINE__, $db->error());
    $attach_num = $db->num_rows($result_attach);
    if($attach_num > 0){
        if($pun_user['g_id']==PUN_ADMIN)$attach_allow_download=true;
        else{         //fetch the rules of the forum, and check so that the user is allowed to download.
            $result_attach_two = $db->query('SELECT ar.rules FROM '.$db->prefix.'attach_2_rules AS ar WHERE ar.group_id=\''.$pun_user['group_id'].'\' AND ar.forum_id='.$cur_topic['forum_id'].' LIMIT 1')or error('Unable to fetch rules for the attachments', __FILE__, __LINE__, $db->error());
            if($db->num_rows($result_attach_two)==1){
                list($attach_rules)=$db->fetch_row($result_attach_two);
                $attach_allow_download = attach_rules($attach_rules,ATTACH_DOWNLOAD);
            }
        }
        if($attach_allow_download){//check if the user is allowed to download it.
            $attach_output .= $lang_attach['Attachments:'].' ';
            while(list($attachment_id, $attachment_filename, $attachment_size, $attachment_downloads)=$db->fetch_row($result_attach)){
                $attachment_extension=attach_get_extension($attachment_filename);
                $attach_output .= '<br />'."\n\t\t\t\t\t\t".attach_icon($attachment_extension).' <a href="./attachment.php?item='.$attachment_id.'">'.$attachment_filename.'</a>, '.$lang_attach['Size:'].' '.number_format($attachment_size).' '.$lang_attach['bytes'].', '.$lang_attach['Downloads:'].' '.number_format($attachment_downloads);
            }
        }
    }
    // Attachment Mod Block End

with:

    // Attachment Mod Block Start
    $attach_allow_download = false;
    $attach_output = '';
    $attach_num = 0;
    // Check if this post has any attachments
    $result_attach = $db->query('SELECT af.id, af.filename, af.size, af.downloads FROM '.$db->prefix.'attach_2_files AS af WHERE af.post_id='.$cur_post['id']) or error('Unable to fetch if there were any attachments to the post', __FILE__, __LINE__, $db->error());
    $attach_num = $db->num_rows($result_attach);
    if($attach_num > 0){
        if($pun_user['g_id']==PUN_ADMIN)$attach_allow_download=true;
        else{         //fetch the rules of the forum, and check so that the user is allowed to download.
            $result_attach_two = $db->query('SELECT ar.rules FROM '.$db->prefix.'attach_2_rules AS ar WHERE ar.group_id=\''.$pun_user['group_id'].'\' AND ar.forum_id='.$cur_topic['forum_id'].' LIMIT 1')or error('Unable to fetch rules for the attachments', __FILE__, __LINE__, $db->error());
            if($db->num_rows($result_attach_two)==1){
                list($attach_rules)=$db->fetch_row($result_attach_two);
                $attach_allow_download = attach_rules($attach_rules,ATTACH_DOWNLOAD);
            }
        }
        if($attach_allow_download){//check if the user is allowed to download it.
            $attach_output .= $lang_attach['Attachments:'].' ';
            while(list($attachment_id, $attachment_filename, $attachment_size, $attachment_downloads)=$db->fetch_row($result_attach)){
                $attachment_extension=attach_get_extension($attachment_filename);
                $attach_output .= '<br />'."\n\t\t\t\t\t\t".attach_icon($attachment_extension).' <a href="./attachment.php?item='.$attachment_id.'">'.$attachment_filename.'</a>, '.$lang_attach['Size:'].' '.number_format($attachment_size).' '.$lang_attach['bytes'].', '.$lang_attach['Downloads:'].' '.number_format($attachment_downloads);
            }
        }
        //////->Added
        else {
            $attach_output .= $lang_attach['Attachments:'].' ';
            while(list($attachment_id, $attachment_filename, $attachment_size, $attachment_downloads)=$db->fetch_row($result_attach)){
                $attachment_extension=attach_get_extension($attachment_filename);
                $attach_output .= '<br />'."\n\t\t\t\t\t\t".attach_icon($attachment_extension).$attachment_filename.', '.$lang_attach['Size:'].' '.number_format($attachment_size).' '.$lang_attach['bytes'].', '.$lang_attach['Downloads:'].' '.number_format($attachment_downloads);
            }
            $attach_output .= '<br /><b>'.$lang_attach['notallowed'].'</b>';
        }
        /////
    }
    // Attachment Mod Block End

3. Replace:

<?php if ($attach_allow_download) echo "\t\t\t\t\t".'<div class="postsignature"><hr />'.$attach_output.'</div>'."\n"; ## Attachment Mod row ?>

with:

<?php /*if ($attach_allow_download)*/ echo "\t\t\t\t\t".'<div class="postsignature"><hr />'.$attach_output.'</div>'."\n"; ## Attachment Mod row ?>

4. Save and upload
5. Open  lang/english/attach.php
6. After line 10, add (don't forget to change the text between ' ' with something else) :

'notallowed'            =>    'some text to inform guests that they can download files only if they have an account',

7. Save and upload


I hope this will make more users to register on your forum.
Sorry again for my poor english!


Stefan

Ok! It was only a suggestion that in my opinion, can make more guests to register... The curiosity is a great thing smile Anyway, when I'll have a little time, I'll look at the code and if I'll find a solution I will inform you.

Thanks again,
Stefan

Hello,

It will be nice for guests to be able to see that one post has attachaments even if they can't download them. If he or she doesn't have the right to download the file, then, when the user clicks the attachament, it will be nice to inform him that he can only get that file if he makes an account...

P.S.: Sorry for my poor english!

Thanks,
Stefan