Thank you very much. Worked like a charm. smile

Yes, it is the user blogs mod I am using..There is always a connection to the DB on my local site.

I am trying to add an image in my blog.php file such as:

<img src="img/'.$pun_user['style'].'/icon_small.gif" alt="" />

I tried adding:
global $pun_user;

but this does nothing. What would I need to add to get it to work?

Thanks
Bingiman

why would it not show AM or PM as well?

Never mind. I think I got it now. I changed t.id to p.id and it seemed to resolve the issue.

Below is my complete mod_active_topics file.

<?php
/*

PunBB Active Topics

Copyright 2004-2005 Alex King, http://www.alexking.org/

This is a mod for PunBB, http://www.punbb.org/
PunBB is Copyright (C) 2002, 2003, 2004  Rickard Andersson (rickard@punbb.org)

This file is based on the viewtopic.php file in PunBB.

-------------------------------
*/

$ak_limit = 10; // change this to the number of active topics you want to display.

$result = $db->query('
    SELECT t.*, p.poster_id AS has_posted
    FROM '.$db->prefix.'topics AS t 

LEFT JOIN '.$db->prefix.'posts AS p ON t.id=p.topic_id AND p.poster_id='.$pun_user['id'].' 
    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
    ) 
    ORDER BY t.last_post DESC
    LIMIT '.$ak_limit
) or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());

require PUN_ROOT.'lang/'.$pun_user['language'].'/forum.php';

$new_topics = get_all_new_topics();

?>

<div id="vf" class="blocktable">
    <h2><span>Latest Active Topics</span></h2>


    <div class="box">
        <div class="inbox">
            <table cellspacing="0">
            <thead>
                <tr><th style="border-left: 0px;" class="tc0"> </th>
                    <th class="tcl" scope="col"><?php echo $lang_common['Topic'] ?></th>
                    <th class="tc2" scope="col"><?php echo $lang_common['Replies'] ?></th>
                    <th class="tc3" scope="col"><?php echo $lang_forum['Views'] ?></th>
                    <th class="tcr" scope="col"><?php echo $lang_common['Last post'] ?></th>
                </tr>
            </thead>
            <tbody>
<?php

// If there are topics in this forum.
if ($db->num_rows($result))
{
// added for forum row differnetial colors
$alt = true;
// added for forum row differnetial colors

    while ($cur_topic = $db->fetch_assoc($result))
    {
// added for forum row differnetial colors
    $alt = !$alt;
// added for forum row differnetial colors

        $icon_text = $lang_common['Normal icon'];
        $item_status = '';
        $icon_type = 'icon';

        if ($cur_topic['moved_to'] == null)
            $last_post = '<a href="viewtopic.php?pid='.$cur_topic['last_post_id'].'#p'.$cur_topic['last_post_id'].'">'.format_time($cur_topic['last_post']).'</a> <br /><span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_topic['last_poster']).'</span>';
        else
            $last_post = ' ';

        if ($pun_config['o_censoring'] == '1')
            $cur_topic['subject'] = censor_words($cur_topic['subject']);

        if ($cur_topic['moved_to'] != 0) {
            $item_status .= 'imoved';
            $icon_type = 'icon imoved';
            $subject = $lang_forum['Moved'].': <a href="viewtopic.php?id='.$cur_topic['moved_to'].'">'.pun_htmlspecialchars($cur_topic['subject']).'</a> <br /><span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_topic['poster']).'</span>';
}
        else if ($cur_topic['closed'] == '0')
            $subject = '<a href="viewtopic.php?id='.$cur_topic['id'].'">'.pun_htmlspecialchars($cur_topic['subject']).'</a> <span class=""><br />'.$lang_common['by'].' '.pun_htmlspecialchars($cur_topic['poster']).'</span>';
        else
        {
            $subject = '<a href="viewtopic.php?id='.$cur_topic['id'].'">'.pun_htmlspecialchars($cur_topic['subject']).'</a> <br /><span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_topic['poster']).'</span>';
            $icon_text = $lang_common['Closed icon'];
            $item_status = 'iclosed';
        }
                            // gleek edit
                        if ($cur_topic['num_replies'] >= $pun_config['o_hot_count'])
                        {
                                $item_status .= ' ihot';
                                $icon_type = 'icon ihot';
                        }
        if (!$pun_user['is_guest'] && topic_is_new($cur_topic['id'], $id,  $cur_topic['last_post']) && $cur_topic['moved_to'] == null)
        {
            $icon_text .= ' '.$lang_common['New icon'];
            $item_status .= ' inew';
            $icon_type = 'icon inew';
            $subject = '<strong>'.$subject.'</strong>';
            $subject_new_posts = '<span class="newtext">[<a href="viewtopic.php?id='.$cur_topic['id'].'&action=new" title="'.$lang_common['New posts info'].'">'.$lang_common['New posts'].'</a>]</span>';
        }
        else
            $subject_new_posts = null;

        // Should we display the dot or not? :)
        if (!$pun_user['is_guest'] && $pun_config['o_show_dot'] == '1')
        {
            if ($cur_topic['has_posted'] == $pun_user['id'])
                $subject = '<img src="img/'.$pun_user['style'].'/buttons/btn_just_posted.png" title="'.$lang_forum['User has just posted'].'" alt="'.$lang_forum['User has just posted'].'" /> '.$subject;
            else
                $subject = '  '.$subject;
        }

        if ($cur_topic['sticky'] == '1')
        {
            $subject = '<span class="stickytext">'.$lang_forum['Sticky'].': </span>'.$subject;
            $item_status .= ' isticky';
            $icon_text .= ' '.$lang_forum['Sticky'];
        }

        $num_pages_topic = ceil(($cur_topic['num_replies'] + 1) / $pun_user['disp_posts']);

        if ($num_pages_topic > 1)
            $subject_multipage = '[ '.paginate($num_pages_topic, -1, 'viewtopic.php?id='.$cur_topic['id']).' ]';
        else
            $subject_multipage = null;

        // Should we show the "New posts" and/or the multipage links?
        if (!empty($subject_new_posts) || !empty($subject_multipage))
        {
            $subject .= '  '.(!empty($subject_new_posts) ? $subject_new_posts : '');
            $subject .= !empty($subject_multipage) ? ' '.$subject_multipage : '';
        }
// added for forum row differnetial colors
if ($alt)
{
    $item_status .= ' alt';
}
// added for forum row differnetial colors
?>
                <tr<?php if ($item_status != '') echo ' class="'.trim($item_status).'"'; ?>><td style="border-left: 0;" class="tc0"><div class="<?php echo $icon_type ?>"> </div></td>
                    <td class="tc1"><?php echo $subject."\n" ?> </td>


                    <td class="tc2"><?php echo ($cur_topic['moved_to'] == null) ? $cur_topic['num_replies'] : ' ' ?></td>
                    <td class="tc3"><?php echo ($cur_topic['moved_to'] == null) ? $cur_topic['num_views'] : ' ' ?></td>


<?php
        if ($cur_topic['moved_to'] != 0) {
            $item_status .= 'imoved';
            $icon_type = 'icon imoved';
            echo '<td class="tcr"><img src="'.$pun_config['o_base_url'].'/img/topic_moved.gif" alt="Moved" title="Moved" /> Topic Moved</td>';
}else {


?>


                    <td class="tcr"><?php echo $last_post ?></td>
                </tr>
<?php
}
    }
}
else
{

?>
                <tr>
                    <td class="tcl" colspan="5"><?php echo $lang_forum['Empty forum'] ?></td>
                </tr>
<?php

}

?>
            </tbody>
            </table>
        </div>
    </div>
</div>

Can someone please help me with the code above It works but I am getting the same post showing twice .

Thanks

I think I got it but can someone please tell me if it is correct. It does work after I modified the query.

$result = $db->query('
    SELECT p.poster_id AS has_posted, t.* 
    FROM '.$db->prefix.'topics AS t 

LEFT JOIN '.$db->prefix.'posts AS p ON t.id=p.topic_id AND p.poster_id='.$pun_user['id'].' 
    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
    ) 
    ORDER BY t.last_post DESC
    LIMIT '.$ak_limit
) or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());

Here is my code below. It is for the mod_active_topics mod. I can see the code for the "dot" next to the username that posted earlier but it doesn't show the dot.
Can someone please tellme what I am missing. I am assuming it is in the query but I don't know how to add it.

<?php
/*

PunBB Active Topics

Copyright 2004-2005 Alex King, http://www.alexking.org/

This is a mod for PunBB, http://www.punbb.org/
PunBB is Copyright (C) 2002, 2003, 2004  Rickard Andersson (rickard@punbb.org)

This file is based on the viewtopic.php file in PunBB.

-------------------------------
*/

$ak_limit = 10; // change this to the number of active topics you want to display.

$result = $db->query('
    SELECT t.* 
    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
    ) 
    ORDER BY t.last_post DESC
    LIMIT '.$ak_limit
) or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());

require PUN_ROOT.'lang/'.$pun_user['language'].'/forum.php';

$new_topics = get_all_new_topics();

?>

<div id="vf" class="blocktable">
    <h2><span>Latest Active Topics</span></h2>


    <div class="box">
        <div class="inbox">
            <table cellspacing="0">
            <thead>
                <tr><th style="border-left: 0px;" class="tc0"> </th>
                    <th class="tcl" scope="col"><?php echo $lang_common['Topic'] ?></th>
                    <th class="tc2" scope="col"><?php echo $lang_common['Replies'] ?></th>
                    <th class="tc3" scope="col"><?php echo $lang_forum['Views'] ?></th>
                    <th class="tcr" scope="col"><?php echo $lang_common['Last post'] ?></th>
                </tr>
            </thead>
            <tbody>
<?php

// If there are topics in this forum.
if ($db->num_rows($result))
{
// added for forum row differnetial colors
$alt = true;
// added for forum row differnetial colors

    while ($cur_topic = $db->fetch_assoc($result))
    {
// added for forum row differnetial colors
    $alt = !$alt;
// added for forum row differnetial colors

        $icon_text = $lang_common['Normal icon'];
        $item_status = '';
        $icon_type = 'icon';

        if ($cur_topic['moved_to'] == null)
            $last_post = '<a href="viewtopic.php?pid='.$cur_topic['last_post_id'].'#p'.$cur_topic['last_post_id'].'">'.format_time($cur_topic['last_post']).'</a> <br /><span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_topic['last_poster']).'</span>';
        else
            $last_post = ' ';

        if ($pun_config['o_censoring'] == '1')
            $cur_topic['subject'] = censor_words($cur_topic['subject']);

        if ($cur_topic['moved_to'] != 0) {
            $item_status .= 'imoved';
            $icon_type = 'icon imoved';
            $subject = $lang_forum['Moved'].': <a href="viewtopic.php?id='.$cur_topic['moved_to'].'">'.pun_htmlspecialchars($cur_topic['subject']).'</a> <br /><span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_topic['poster']).'</span>';
}
        else if ($cur_topic['closed'] == '0')
            $subject = '<a href="viewtopic.php?id='.$cur_topic['id'].'">'.pun_htmlspecialchars($cur_topic['subject']).'</a> <span class=""><br />'.$lang_common['by'].' '.pun_htmlspecialchars($cur_topic['poster']).'</span>';
        else
        {
            $subject = '<a href="viewtopic.php?id='.$cur_topic['id'].'">'.pun_htmlspecialchars($cur_topic['subject']).'</a> <br /><span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_topic['poster']).'</span>';
            $icon_text = $lang_common['Closed icon'];
            $item_status = 'iclosed';
        }
                            // gleek edit
                        if ($cur_topic['num_replies'] >= $pun_config['o_hot_count'])
                        {
                                $item_status .= ' ihot';
                                $icon_type = 'icon ihot';
                        }
        if (!$pun_user['is_guest'] && topic_is_new($cur_topic['id'], $id,  $cur_topic['last_post']) && $cur_topic['moved_to'] == null)
        {
            $icon_text .= ' '.$lang_common['New icon'];
            $item_status .= ' inew';
            $icon_type = 'icon inew';
            $subject = '<strong>'.$subject.'</strong>';
            $subject_new_posts = '<span class="newtext">[<a href="viewtopic.php?id='.$cur_topic['id'].'&action=new" title="'.$lang_common['New posts info'].'">'.$lang_common['New posts'].'</a>]</span>';
        }
        else
            $subject_new_posts = null;

        // Should we display the dot or not? :)
        if (!$pun_user['is_guest'] && $pun_config['o_show_dot'] == '1')
        {
            if ($cur_topic['has_posted'] == $pun_user['id'])
                $subject = '<strong>·</strong> '.$subject;
            else
                $subject = '  '.$subject;
        }

        if ($cur_topic['sticky'] == '1')
        {
            $subject = '<span class="stickytext">'.$lang_forum['Sticky'].': </span>'.$subject;
            $item_status .= ' isticky';
            $icon_text .= ' '.$lang_forum['Sticky'];
        }

        $num_pages_topic = ceil(($cur_topic['num_replies'] + 1) / $pun_user['disp_posts']);

        if ($num_pages_topic > 1)
            $subject_multipage = '[ '.paginate($num_pages_topic, -1, 'viewtopic.php?id='.$cur_topic['id']).' ]';
        else
            $subject_multipage = null;

        // Should we show the "New posts" and/or the multipage links?
        if (!empty($subject_new_posts) || !empty($subject_multipage))
        {
            $subject .= '  '.(!empty($subject_new_posts) ? $subject_new_posts : '');
            $subject .= !empty($subject_multipage) ? ' '.$subject_multipage : '';
        }
// added for forum row differnetial colors
if ($alt)
{
    $item_status .= ' alt';
}
// added for forum row differnetial colors
?>
                <tr<?php if ($item_status != '') echo ' class="'.trim($item_status).'"'; ?>><td style="border-left: 0;" class="tc0"><div class="<?php echo $icon_type ?>"> </div></td>
                    <td class="tc1"><?php echo $subject."\n" ?> </td>


                    <td class="tc2"><?php echo ($cur_topic['moved_to'] == null) ? $cur_topic['num_replies'] : ' ' ?></td>
                    <td class="tc3"><?php echo ($cur_topic['moved_to'] == null) ? $cur_topic['num_views'] : ' ' ?></td>
                    <td class="tcr"><?php echo $last_post ?></td>
                </tr>
<?php

    }
}
else
{

?>
                <tr>
                    <td class="tcl" colspan="5"><?php echo $lang_forum['Empty forum'] ?></td>
                </tr>
<?php

}

?>
            </tbody>
            </table>
        </div>
    </div>
</div>

Thanks

185

(2 replies, posted in PunBB 1.2 discussion)

http://www.punres.org/files.php?pid=465

Wow! That did it...

Thank you very much Smartys. You always save the day. smile

Update: I know that they aren't standard queries. That's why I mentioned that you helped me to modify it.

Well, Once I copy the code shown in post #6 it displays the Moved to: but once I use the one in post #6 (bottom) it doesn't work. So the problem has to be in that sql area.

I am pretty sure it was you. I don't recall anyone else helping me with it. Anyway, I tried that but it still doesn't display the Moved topic.

This is the one I am using now:

    $sql = 'SELECT t.id, t.poster, t.subject, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to, question, rating, labels, icon_topic, p.poster_id AS last_poster_id FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'posts AS p ON (p.id=t.last_post_id) WHERE forum_id='.$id.' ORDER BY sticky DESC, '.(($cur_forum['sort_by'] == '1') ? 'posted' : 'last_post').' DESC LIMIT '.$start_from.', '.$pun_user['disp_topics'];

In the original version of my viewforum I had the following codE:

        // Without "the dot"
    $sql = 'SELECT t.id, t.poster, t.subject, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to, question, rating, labels, icon_topic, p.poster_id AS last_poster_id FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'posts AS p ON (p.id=t.last_post_id) WHERE forum_id='.$id.' ORDER BY sticky DESC, '.(($cur_forum['sort_by'] == '1') ? 'posted' : 'last_post').' DESC LIMIT '.$start_from.', '.$pun_user['disp_topics'];

but then I had help from Smartys to modify it to view the user profile as a link and this is the new query.

        // Without "the dot"
        $sql = 'SELECT id, poster, subject, posted, last_post, last_post_id, last_poster, num_views, num_replies, closed, sticky, moved_to, question, rating, icon_topic, labels FROM '.$db->prefix.'topics WHERE forum_id='.$id.' ORDER BY sticky DESC, '.(($cur_forum['sort_by'] == '1') ? 'posted' : 'last_post').' DESC LIMIT '.$start_from.', '.$pun_user['disp_topics'];

Now, the problem I am having is that I can no longer see the Moved topics on the viewform. If however I use the old query then it works as it should. How can I modify it so that I can see the Moved topics?

Thank for the help.
Bingiman

Ok, I understand that, but if I do not check it shouldn't it still show as a moved topics with the text Moved: Also, why in my case it does not display an icon?

Isn't this correct:

tr.imoved div.icon {
background-image:url(../../img/ShowcaseII/moved.png);
background-repeat:no-repeat;
}

Also, why does it only show Moved: in the mod_active_topics I am using on the front page. How else would I have seen the Moved: if I weren't using this mod? I don't see it in viewforum.

Ok, so by that what do you mean exactly? Isn't it the same as if I moved a topic from Forum #1 to Forum #2? I don't see the difference in what I posted and your response.

I am trying to figure out exactly how this works. If I move a post why is it I don't see the text moved next to it. The only time I see it is in the mod_active_topics that I use on my index. I even tried a fresh install of pun and I still don't see it. In my case I use images for all so if I can see an image for $icon_type = 'icon inew';
then why I can I see one for: $icon_type = 'icon imoved';? Maybe someone can shed some light on this for me. This is extremely confusing.

update: The only way I can see the icon is if I checge this:

if ($cur_topic['moved_to'] != 0)

to:

if ($cur_topic['moved_to'] != 1)

Thanks
Bingiman.

I sent you an email yesterday. I will wait for your response.

Cheers!
Bingiman

194

(7 replies, posted in General discussion)

My site is back up now and your question was answered. big_smile

Well, i have tried over 6 hosts in the last 3 months and I have had nothing but problems. I even went on a VPS with westhost and they are always having problems. I just can't find a reliable host anywhere. I've read so many reviews on so many but it seems like everyone I try just keeps getting worse.

http://www.bugmenot.com/view/forums.punbb.org

tested the login info and it does work.

Who is punbb.org hosted with?

198

(11 replies, posted in PunBB 1.2 troubleshooting)

I doubt that it had anything to do with Mega Pun. Have you tried it again since. Also, why didn't you ask over on the site. I would have more than happy to assist you until a solution was found.

Bingiman

199

(11 replies, posted in PunBB 1.2 troubleshooting)

What exactly was it doing? Just hanging there? It should have worked because it does on the http://shedrockonline.com and that's an area I never played with. I have only added mods to the site, nothing more.

200

(11 replies, posted in PunBB 1.2 troubleshooting)

werny wrote:

I tried the new mega pun 2 days ago from here and the redirection didnt work, so I just scrapped it and went back to my old settings

The redirection didn't work for you? I wonder why it works for everyone else then...hmm...weird.