1 (edited by Mr Puto 2006-03-12 23:26)

Topic: Announcement topic mod.

##
##
##        Mod title:  Announcements
##
##      Mod version:  1.0.5
##   Works on PunBB:  1.2.3, 1.2.4
##     Release date:  3-26-05
##           Author:  Alex Capek - i.is.alex@hotmail.com
##
##      Description:  This modifications allows you to Announce topics, same thing as Sticky's, but you still have Sticky's.
##
##       Affects DB:  Yes
##
##   Affected files:  viewforum.php
##                    footer.php
##                    lang/LANGUAGE/common.php
##                    lang/LANGUAGE/misc.php
##       moderate.php
##       viewtopic.php
##
##            Notes:  The Announcements will appear at the top of the topics on viewforum.
##
##       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.
##

Click here to go to PunRes to Download

This mod is fairly new there might be some small bugs..please post if you find any.

Re: Announcement topic mod.

Updated with a link to PunRes.

3

Re: Announcement topic mod.

Hello,

Attempting to do this mod and i'm a little confused at your steps 16-18.  Looks like step 16 you ask us to search for something and add the code in step 17.  Are we then supposed to replace what was searched for in step 16 with step 18?

#
#---------[ 16. FIND (line:513) ]---------------------------------------------------
#

else if (isset($_GET['unstick']))
{
    confirm_referrer('viewtopic.php');

    $unstick = intval($_GET['unstick']);
    if ($unstick < 1)
        message($lang_common['Bad request']);

    $db->query('UPDATE '.$db->prefix.'topics SET sticky=\'0\' WHERE id='.$unstick) or error('Unable to unstick topic', __FILE__, __LINE__, $db->error());

    redirect('viewtopic.php?id='.$unstick, $lang_misc['Unstick topic redirect']);
}

#
#---------[ 17. AFTER, ADD ]---------------------------------------------------
#

//Announce a topic
else if (isset($_GET['announce']))
{
    confirm_referrer('viewtopic.php');

    $stick = intval($_GET['announce']);
    if ($stick < 1)
        message($lang_common['Bad request']);

    $db->query('UPDATE '.$db->prefix.'topics SET announcement=\'1\' WHERE id='.$stick) or error('Unable to announce topic', __FILE__, __LINE__, $db->error());

    redirect('viewtopic.php?id='.$stick, $lang_misc['Announce topic redirect']);
}


// Un-Announce
else if (isset($_GET['unannounce']))
{
    confirm_referrer('viewtopic.php');

    $unstick = intval($_GET['unannounce']);
    if ($unstick < 1)
        message($lang_common['Bad request']);

    $db->query('UPDATE '.$db->prefix.'topics SET announcement=\'0\' WHERE id='.$unstick) or error('Unable to un-announce topic', __FILE__, __LINE__, $db->error());

    redirect('viewtopic.php?id='.$unstick, $lang_misc['Unannounce topic redirect']);
}

#
#---------[ 18. REPLACE WITH ]---------------------------------------------------
#

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