Is there a shop mod to sell products or is anyone interested in working with me on this mod.
example at http://boys.brigadeaustralia.org/shop/index.php

How can I recode punbb so I can have multiple forums and one user table in the database.

This is a excellent addition.
ross3093 can you please add code to remove bbcode from the truncated paragraph so only text is displayed, no images etc.

4

(7 replies, posted in Feature requests)

To have the logout link you require

in header.php
replace

    $tpl_temp = '<div id="brdwelcome" class="inbox">'."\n\t\t\t".'<ul class="conl">'."\n\t\t\t\t".'<li>'.$lang_common['Logged in as'].' <strong>'.pun_htmlspecialchars($pun_user['username']).'</strong></li>'."\n\t\t\t\t".'<li>'.$lang_common['Last visit'].': '.format_time($pun_user['last_visit']).'</li>';

with

    $tpl_temp = '<div id="brdwelcome" class="inbox">'."\n\t\t\t".'<ul class="conl">'."\n\t\t\t\t".'<li>'.$lang_common['Logged in as'].' <strong>'.pun_htmlspecialchars($pun_user['username']).'</strong> - <a href="login.php?action=out&id='.$pun_user['id'].'">'.$lang_common['Logout'].'</a></li>'."\n\t\t\t\t".'<li>'.$lang_common['Last visit'].': '.format_time($pun_user['last_visit']).'</li>';

Hi Did this work before you modified the code last night. please post an image on your site in the top forum.

6

(16 replies, posted in Feature requests)

Thank you for your help.
I have added the correction to the code above.

7

(16 replies, posted in Feature requests)

TFD wrote:

Ok Im going to change the database and all the php files back to original.

Hi I missed part of the mod see the mod code above I have added

#
#---------[ 6. FIND ]
#
    // Fetch forum info
    $result = $db->query('SELECT id, forum_name, forum_desc, redirect_url, num_topics, sort_by, cat_id FROM '.$db->prefix.'forums WHERE id='.$forum_id) or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error());
    if (!$db->num_rows($result))
        message($lang_common['Bad request']);
#
#---------[ 7. REPLACE WITH ]
#

    // Fetch forum info
    $result = $db->query('SELECT id, forum_name, forum_desc, redirect_url, num_topics, sort_by, cat_id, no_images FROM '.$db->prefix.'forums WHERE id='.$forum_id) or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error());
    if (!$db->num_rows($result))
        message($lang_common['Bad request']);

This picks up the value of the no_images from the database.
This mod does work.

8

(16 replies, posted in Feature requests)

TFD wrote:

hmm doesnt seem to be working. I turned imgs on in permissions then went to the forum and  went  to "turn images off?" and set it to YES and saved. When I go back it is reset to NO. DOes this in each forum that I change. Always resets to NO.

You need to add the field in the forum database through your server control panel and myphpadmin. See the last of the install description.

9

(16 replies, posted in Feature requests)

TFD wrote:

wait I had reuploaded my original code but it didnt show. So I went back and this is what My code shows:


        if ($pun_config['p_message_img_tag'] == '1')
        {
//            $text = preg_replace('#\[img\]((ht|f)tps?://)([^\s<"]*?)\.(jpg|jpeg|png|gif)\[/img\]#e', 'handle_img_tag(\'$1$3.$4\')', $text);
            $text = preg_replace('#\[img\]((ht|f)tps?://)([^\s<"]*?)\[/img\]#e', 'handle_img_tag(\'$1$3\')', $text);
        }


You say to look for:

if ($pun_config['p_message_img_tag'] == '1')
    {
        $text = preg_replace('#\[img\]((ht|f)tps?://)([^\s<"]*?)\.(jpg|jpeg|png|gif)\[/img\]#e', 'handle_img_tag(\'$1$3.$4\',\'right\')', $text);
    }


There is a difference between what comes default in mine and what you say to  look for, an extra line of code with the line you want me to replace is // out.

Please advise!! Thanks

Hi Sorry code you have as quoted above is correct ie two lines of code. Leave your code as is.
I modified the parser code at this point to allow images to be aligned left or right for web pages.

10

(16 replies, posted in Feature requests)

I have a mod for you

##   Mod title:  Switch Images off in a Forum.
##   Mod version:  1.0 Beta
##   Works on PunBB:  1.2.*
##   Release date:  2006-03-18
##   Author:  Peter Shave - test.oziweb.org
##   Description:  Allows images to be turned off in a forum.
##   Affected files:  admin_forum.php
##                        view_topic.php
##                        include/parser.php
##   Affects DB:  Yes
##                    Add field no_images to forums table.
##                    type tinyint 1 default value =0             
##   Notes:  No
##   Update Notes:  No update available from old version.
##
##   DISCLAIMER:  Please note that "mods" are not officially supported by
##                    PunBB. Installation of this modification is done at your
##                    own risk. Backup your forum database and any and all
##                    applicable files before proceeding.


#---------[ 1. OPEN ]

    admin_forums.php

#---------[ 2. Find (about line 170)]

    // Start with the forum details
    $forum_name = trim($_POST['forum_name']);
    $forum_desc = pun_linebreaks(trim($_POST['forum_desc']));
    $cat_id = intval($_POST['cat_id']);
    $sort_by = intval($_POST['sort_by']);

#---------[ 3. ADD AFTER ]

    $no_images = intval($_POST['no_images']);

#---------[ 4. FIND (about line 182)]

    $db->query('UPDATE '.$db->prefix.'forums SET forum_name=\''.$db->escape($forum_name).'\', forum_desc='.$forum_desc.', redirect_url='.$redirect_url.', sort_by='.$sort_by.', cat_id='.$cat_id.' WHERE id='.$forum_id) or error('Unable to update forum', __FILE__, __LINE__, $db->error());

#---------[ 5. Comment out above line and add below ]

    $db->query('UPDATE '.$db->prefix.'forums SET forum_name=\''.$db->escape($forum_name).'\', forum_desc='.$forum_desc.', redirect_url='.$redirect_url.', sort_by='.$sort_by.', cat_id='.$cat_id.' ,no_images='.$no_images.' WHERE id='.$forum_id) or error('Unable to update forum', __FILE__, __LINE__, $db->error());

#---------[ 4. FIND ]

    // Fetch forum info
    $result = $db->query('SELECT id, forum_name, forum_desc, redirect_url, num_topics, sort_by, cat_id FROM '.$db->prefix.'forums WHERE id='.$forum_id) or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error());

#---------[ 5. COMMENT OUT ABOVE LINE AND ADD BELOW ]

    // Fetch forum info
    $result = $db->query('SELECT id, forum_name, forum_desc, redirect_url, num_topics, sort_by, cat_id, no_images FROM '.$db->prefix.'forums WHERE id='.$forum_id) or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error());

#---------[ 6. FIND  (about line 280)]

    <tr>
        <th scope="row">Sort topics by</th>
        <td>
        <select name="sort_by" tabindex="4">
        <option value="0"<?php if ($cur_forum['sort_by'] == '0') echo ' selected="selected"' ?>>Last post</option>
        <option value="1"<?php if ($cur_forum['sort_by'] == '1') echo ' selected="selected"' ?>>Topic start</option>
        </select>
        </td>
    </tr>

#---------[ 7. ADD AFTER ]

    <tr>
        <th scope="row">Turn images off</th>
        <td>
        <select name="no_images" tabindex="5">
        <option value="0"<?php if ($cur_forum['no_images'] == '0') echo ' selected="selected"' ?>>No</option>
        <option value="1"<?php if ($cur_forum['no_images'] == '1') echo ' selected="selected"' ?>>Yes</option>
        </select>
        </td>
    </tr>

###########################################################################################

#---------[ 8. OPEN ]

    viewtopic.php

#---------[ 9. FIND ]

    // Fetch some info about the topic
    if (!$pun_user['is_guest'])
        $result = $db->query('SELECT t.subject, t.closed, t.num_replies, t.sticky, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, s.user_id AS is_subscribed FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'subscriptions AS s ON (t.id=s.topic_id AND s.user_id='.$pun_user['id'].') 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 t.id='.$id.' AND t.moved_to IS NULL') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
    else
        $result = $db->query('SELECT t.subject, t.closed, t.num_replies, t.sticky, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, 0 FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id 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 t.id='.$id.' AND t.moved_to IS NULL') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());

    if (!$db->num_rows($result))
        message($lang_common['Bad request']);

    $cur_topic = $db->fetch_assoc($result);
    
#---------[ 10. REPLACE WITH ]

    // Fetch some info about the topic
    if (!$pun_user['is_guest'])
        $result = $db->query('SELECT f.no_images, t.subject, t.closed, t.num_replies, t.sticky, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, s.user_id AS is_subscribed FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'subscriptions AS s ON (t.id=s.topic_id AND s.user_id='.$pun_user['id'].') 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 t.id='.$id.' AND t.moved_to IS NULL') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
    else
        $result = $db->query('SELECT f.no_images, t.subject, t.closed, t.num_replies, t.sticky, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, 0 FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id 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 t.id='.$id.' AND t.moved_to IS NULL') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
    if (!$db->num_rows($result))
        message($lang_common['Bad request']);

    $cur_topic = $db->fetch_assoc($result);
    $no_images = $cur_topic['no_images'];

#---------[ 11. FIND ]

    // Perform the main parsing of the message (BBCode, smilies, censor words etc)
    $cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']);

#---------[ 12. REPLACE WITH ]

    // Perform the main parsing of the message (BBCode, smilies, censor words etc)
    $cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies'], $no_images);

###########################################################################################

#---------[ 13. OPEN ]

    include/parser.php

#---------[ 14. FIND ]

    // Parse message text
    //
    function parse_message($text, $hide_smilies)

#---------[ 15. REPLACE WITH ]

    // Parse message text
    //
    function parse_message($text, $hide_smilies,$no_images='0')

#---------[ 16. FIND ]

        if ($pun_config['p_message_img_tag'] == '1')
        {
//            $text = preg_replace('#\[img\]((ht|f)tps?://)([^\s<"]*?)\.(jpg|jpeg|png|gif)\[/img\]#e', 'handle_img_tag(\'$1$3.$4\')', $text);
            $text = preg_replace('#\[img\]((ht|f)tps?://)([^\s<"]*?)\[/img\]#e', 'handle_img_tag(\'$1$3\')', $text);
        }

#---------[ 17. REPLACE WITH ]

    if ($no_images != '1')
    {
        if ($pun_config['p_message_img_tag'] == '1')
        {
//            $text = preg_replace('#\[img\]((ht|f)tps?://)([^\s<"]*?)\.(jpg|jpeg|png|gif)\[/img\]#e', 'handle_img_tag(\'$1$3.$4\')', $text);
            $text = preg_replace('#\[img\]((ht|f)tps?://)([^\s<"]*?)\[/img\]#e', 'handle_img_tag(\'$1$3\')', $text);
        }
    }
    else
    {
        $text = preg_replace('#\[img\]((ht|f)tps?://)([^\s<"]*?)\[/img\]#e', '', $text);
    }

#---------[ ADD FIELD TO DATABASE ]

Do not forget to add a new field to the forums table.
field = no_images
type = tinyint
length=1
default = 0

#---------[ END OF MOD ]

1. add a new user using punbb
2. copy the above password to the admin record while veiwing the user table.

12

(0 replies, posted in PunBB 1.2 show off)

This web site is for testing mods included with punbb forum.
http://pacamp.brigadeaustralia.org

The main two mods are the calendar and displaying a forum as web pages.

The index page is a topic in the forum displayed as a web page.

Regards
bbaweb

I have reread the instructions. There is no problem Thank you.

Installed a new install of punbb 1.2.10
With avatars turned off in Profile menu of a member - display ie Show user avatars in posts unchecked.

When in a forum topic the avatars are viewable by guests but not by members.