Forums

Unfortunately no one can be told what FluxBB is - you have to see it for yourself.

You are not logged in.

#1 2010-10-23 09:26:50

Visman
Member
From: Siberia
Registered: 2010-07-10
Posts: 1,209
Website

[MOD] Stick First Post - 1.0.2

To stick the first post on all pages of topic (Administrators and moderators can on/off only).

Last version: http://fluxbb.org/resources/mods/stick-first-post/

v 1.0.2
For FluxBB 1.4.4, 1.4.5

*************
The old version:


File install_mod.php

<?php
/***********************************************************************/

// Some info about your mod.
$mod_title      = 'Stick First Post';
$mod_version    = '1.0';
$release_date   = '2010-10-23';
$author         = 'Visman';
$author_email   = 'visman@inbox.ru';

// Versions of FluxBB this mod was created for. A warning will be displayed, if versions do not match
$fluxbb_versions= array('1.4.2');

// Set this to false if you haven't implemented the restore function (see below)
$mod_restore    = true;


// This following function will be called when the user presses the "Install" button
function install()
{
    global $db, $db_type, $pun_config;

    $db->add_field('topics', 'stick_fp', 'TINYINT(1)', false, 0) or error('Unable to add stick_fp field', __FILE__, __LINE__, $db->error());

    // Delete all .php files in the cache (someone might have visited the forums while we were updating and thus, generated incorrect cache files)
    forum_clear_cache();
}

// This following function will be called when the user presses the "Restore" button (only if $mod_restore is true (see above))
function restore()
{
    global $db, $db_type, $pun_config;

    $db->drop_field('topics', 'stick_fp') or error('Unable to drop stick_fp field', __FILE__, __LINE__, $db->error());

    forum_clear_cache();
}

/***********************************************************************/

// DO NOT EDIT ANYTHING BELOW THIS LINE!


// Circumvent maintenance mode
define('PUN_TURN_OFF_MAINT', 1);
define('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';

// only admin
if ($pun_user['g_id'] != PUN_ADMIN)
    redirect('login.php', $lang_common['Redirecting']);

// We want the complete error message if the script fails
if (!defined('PUN_DEBUG'))
    define('PUN_DEBUG', 1);

// Make sure we are running a FluxBB version that this mod works with
$version_warning = !in_array($pun_config['o_cur_version'], $fluxbb_versions);

$style = (isset($pun_user)) ? $pun_user['style'] : $pun_config['o_default_style'];

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo pun_htmlspecialchars($mod_title) ?> installation</title>
<link rel="stylesheet" type="text/css" href="style/<?php echo $style.'.css' ?>" />
</head>
<body>

<div id="punwrap">
<div id="puninstall" class="pun" style="margin: 10% 20% auto 20%">

<?php

if (isset($_POST['form_sent']))
{
    if (isset($_POST['install']))
    {
        // Run the install function (defined above)
        install();

?>
<div class="block">
    <h2><span>Installation successful</span></h2>
    <div class="box">
        <div class="inbox">
            <p>Your database has been successfully prepared for <?php echo pun_htmlspecialchars($mod_title) ?>. See readme.txt for further instructions.</p>
        </div>
    </div>
</div>
<?php

    }
    else
    {
        // Run the restore function (defined above)
        restore();

?>
<div class="block">
    <h2><span>Restore successful</span></h2>
    <div class="box">
        <div class="inbox">
            <p>Your database has been successfully restored.</p>
        </div>
    </div>
</div>
<?php

    }
}
else
{

?>
<div class="blockform">
    <h2><span>Mod installation</span></h2>
    <div class="box">
        <form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>?foo=bar">
            <div><input type="hidden" name="form_sent" value="1" /></div>
            <div class="inform">
                <p>This script will update your database to work with the following modification:</p>
                <p><strong>Mod title:</strong> <?php echo pun_htmlspecialchars($mod_title.' '.$mod_version) ?></p>
                <p><strong>Author:</strong> <?php echo pun_htmlspecialchars($author) ?> (<a href="mailto:<?php echo pun_htmlspecialchars($author_email) ?>"><?php echo pun_htmlspecialchars($author_email) ?></a>)</p>
                <p><strong>Disclaimer:</strong> Mods are not officially supported by FluxBB. Mods generally can't be uninstalled without running SQL queries manually against the database. Make backups of all data you deem necessary before installing.</p>
<?php if ($mod_restore): ?>
                <p>If you've previously installed this mod and would like to uninstall it, you can click the Restore button below to restore the database.</p>
<?php endif; ?>
<?php if ($version_warning): ?>
                <p style="color: #a00"><strong>Warning:</strong> The mod you are about to install was not made specifically to support your current version of FluxBB (<?php echo $pun_config['o_cur_version']; ?>). This mod supports FluxBB versions: <?php echo pun_htmlspecialchars(implode(', ', $fluxbb_versions)); ?>. If you are uncertain about installing the mod due to this potential version conflict, contact the mod author.</p>
<?php endif; ?>
            </div>
            <p class="buttons"><input type="submit" name="install" value="Install" /><?php if ($mod_restore): ?><input type="submit" name="restore" value="Restore" /><?php endif; ?></p>
        </form>
    </div>
</div>
<?php

}

?>

</div>
</div>

</body>
</html>

File readme.txt

##
##
##        Mod title:  Stick First Post
##
##      Mod version:  1.0
##  Works on FluxBB:  1.4.2
##     Release date:  2010-10-23
##      Review date:  YYYY-MM-DD (Leave unedited)
##           Author:  Visman (visman@inbox.ru)
##
##      Description:  Мод закрепления первого сообщения темы на всех ее страницах (Могут включать только админы и модераторы).
##                    To stick the first post on all pages of topic (Administrators and moderators can on/off only).
##                    
##                    
##
##   Repository URL:  http://fluxbb.org/resources/mods/?s=author&t=Visman&v=all&o=name
##                    http://fluxbb.org.ru/forum/viewtopic.php?id=3299
##                    http://fluxbb.org/forums/viewtopic.php?id=4764
##
##   Affected files:  viewtopic.php
##                    post.php
##                    edit.php
##                    /lang/[language]/post.php
##
##       Affects DB:  Yes
##
##            Notes:  Russian/English
##
##       DISCLAIMER:  Please note that "mods" are not officially supported by
##                    FluxBB. Installation of this modification is done at 
##                    your own risk. Backup your forum database and any and
##                    all applicable files before proceeding.
##
##


#
#---------[ 1. UPLOAD ]-------------------------------------------------------
#

install_mod.php to /

#
#---------[ 2. RUN ]----------------------------------------------------------
#

install_mod.php

#
#---------[ 3. DELETE ]-------------------------------------------------------
#

install_mod.php

#
#---------[ 4. OPEN ]---------------------------------------------------------
#

/lang/[language]/post.php

#
#---------[ 5. ADD NEW ELEMENTS OF ARRAY ]------------------------------------
#

'Stick first post' => 'To stick the first post on all pages of topic',

# For Russian
# 'Stick first post' => 'Закрепить первое сообщение на всех страницах темы',

#
#---------[ 6. SAVE ]---------------------------------------------------------
#

/lang/[language]/post.php

#
#---------[ 7. OPEN ]---------------------------------------------------------
#

viewtopic.php

#
#---------[ 8. 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, t.first_post_id, 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, t.first_post_id, 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());

#
#---------[ 9. REPLACE WITH ]-------------------------------------------------
#

// Fetch some info about the topic
if (!$pun_user['is_guest'])
    $result = $db->query('SELECT t.stick_fp, t.subject, t.closed, t.num_replies, t.sticky, t.first_post_id, 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.stick_fp, t.subject, t.closed, t.num_replies, t.sticky, t.first_post_id, 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());

#
#---------[ 10. FIND ]--------------------------------------------------------
#

$post_ids = array();
for ($i = 0;$cur_post_id = $db->result($result, $i);$i++)
    $post_ids[] = $cur_post_id;

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

// StickFP
$stick_fp_flag = ($cur_topic['stick_fp'] != 0);
$stick_fp_start_from = 0;
if ($stick_fp_flag)
    $post_ids[] = $cur_topic['first_post_id'];
// StickFP

#
#---------[ 12. FIND ]--------------------------------------------------------
#

while ($cur_post = $db->fetch_assoc($result))
{

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

    // StickFP
    if ($stick_fp_flag)
    {
        if ($post_count == 0 && $start_from > 0)
        {
            $stick_fp_start_from = $start_from;
            $start_from = 0;
        }
        else if ($start_from == 0 && $stick_fp_start_from > 0)
        {
            $post_count = 0;
            $start_from = $stick_fp_start_from;
?>
<hr>
<?php
        }
    }
    // StickFP

#
#---------[ 14. SAVE ]--------------------------------------------------------
#

viewtopic.php

#
#---------[ 15. OPEN ]--------------------------------------------------------
#

post.php

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

        // If it's a new topic
        else if ($fid)
        {
            // Create the topic
            $db->query('INSERT INTO '.$db->prefix.'topics (poster, subject, posted, last_post, last_poster, forum_id) VALUES(\''.$db->escape($username).'\', \''.$db->escape($subject).'\', '.$now.', '.$now.', \''.$db->escape($username).'\', '.$fid.')') or error('Unable to create topic', __FILE__, __LINE__, $db->error());
            $new_tid = $db->insert_id();

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

        // If it's a new topic
        else if ($fid)
        {
            // StickFP - Visman
            $stick_fp = ($is_admmod && isset($_POST['stickfp'])) ? 1 : 0;
            // Create the topic
            $db->query('INSERT INTO '.$db->prefix.'topics (stick_fp, poster, subject, posted, last_post, last_poster, forum_id) VALUES('.$stick_fp.', \''.$db->escape($username).'\', \''.$db->escape($subject).'\', '.$now.', '.$now.', \''.$db->escape($username).'\', '.$fid.')') or error('Unable to create topic', __FILE__, __LINE__, $db->error());
            $new_tid = $db->insert_id();

#
#---------[ 18. FIND ]--------------------------------------------------------
#

        $checkboxes[] = '<label><input type="checkbox" name="subscribe" value="1" tabindex="'.($cur_index++).'"'.($subscr_checked ? ' checked="checked"' : '').' />'.($is_subscribed ? $lang_post['Stay subscribed'] : $lang_post['Subscribe']).'<br /></label>';
    }

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

    // StickFP
    if ($is_admmod && $fid)
        $checkboxes[] = '<label><input type="checkbox" name="stickfp" value="1" tabindex="'.($cur_index++).'"'.((isset($_POST['stickfp'])) ? ' checked="checked"' : '').' />'.$lang_post['Stick first post'].'<br /></label>';
    // StickFP

#
#---------[ 20. SAVE ]--------------------------------------------------------
#

post.php

#
#---------[ 21. OPEN ]--------------------------------------------------------
#

edit.php

#
#---------[ 22. FIND ]--------------------------------------------------------
#

if ($is_admmod)
{
    if ((isset($_POST['form_sent']) && isset($_POST['silent'])) || !isset($_POST['form_sent']))
        $checkboxes[] = '<label><input type="checkbox" name="silent" value="1" tabindex="'.($cur_index++).'" checked="checked" />'.$lang_post['Silent edit'].'<br /></label>';
    else
        $checkboxes[] = '<label><input type="checkbox" name="silent" value="1" tabindex="'.($cur_index++).'" />'.$lang_post['Silent edit'].'<br /></label>';
}

#
#---------[ 23. REPLACE WITH ]------------------------------------------------
#

if ($is_admmod)
{
    if ((isset($_POST['form_sent']) && isset($_POST['silent'])) || !isset($_POST['form_sent']))
        $checkboxes[] = '<label><input type="checkbox" name="silent" value="1" tabindex="'.($cur_index++).'" checked="checked" />'.$lang_post['Silent edit'].'<br /></label>';
    else
        $checkboxes[] = '<label><input type="checkbox" name="silent" value="1" tabindex="'.($cur_index++).'" />'.$lang_post['Silent edit'].'<br /></label>';
    // StickFP
    if ($can_edit_subject)
    {
        if ((isset($_POST['form_sent']) && isset($_POST['stickfp'])) || (!isset($_POST['form_sent']) && $cur_post['stick_fp'] != 0))
            $checkboxes[] = '<label><input type="checkbox" name="stickfp" value="1" tabindex="'.($cur_index++).'" checked="checked" />'.$lang_post['Stick first post'].'<br /></label>';
        else
            $checkboxes[] = '<label><input type="checkbox" name="stickfp" value="1" tabindex="'.($cur_index++).'" />'.$lang_post['Stick first post'].'<br /></label>';
    }
    // StickFP
}

#
#---------[ 24. FIND ]--------------------------------------------------------
#

// Fetch some info about the post, the topic and the forum
$result = $db->query('SELECT f.id AS fid, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics, t.id AS tid, t.subject, t.posted, t.first_post_id, t.closed, p.poster, p.poster_id, p.message, p.hide_smilies FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_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) AND p.id='.$id) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());

#
#---------[ 25. REPLACE WITH ]------------------------------------------------
#

// Fetch some info about the post, the topic and the forum
$result = $db->query('SELECT f.id AS fid, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics, t.id AS tid, t.stick_fp, t.subject, t.posted, t.first_post_id, t.closed, p.poster, p.poster_id, p.message, p.hide_smilies FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_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) AND p.id='.$id) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());

#
#---------[ 26. FIND ]--------------------------------------------------------
#

            // Update the topic and any redirect topics
            $db->query('UPDATE '.$db->prefix.'topics SET subject=\''.$db->escape($subject).'\' WHERE id='.$cur_post['tid'].' OR moved_to='.$cur_post['tid']) or error('Unable to update topic', __FILE__, __LINE__, $db->error());

#
#---------[ 27. REPLACE WITH ]------------------------------------------------
#

            // StickFP
            $stick_fp = '';
            if ($is_admmod && isset($_POST['stickfp']))
                $stick_fp = 'stick_fp=1, ';
            else if ($is_admmod)
                $stick_fp = 'stick_fp=0, ';
            // StickFP
            // Update the topic and any redirect topics
            $db->query('UPDATE '.$db->prefix.'topics SET '.$stick_fp.'subject=\''.$db->escape($subject).'\' WHERE id='.$cur_post['tid'].' OR moved_to='.$cur_post['tid']) or error('Unable to update topic', __FILE__, __LINE__, $db->error());

#
#---------[ 28. SAVE ]--------------------------------------------------------
#

edit.php

Last edited by Visman (2011-03-23 15:57:22)

Offline

#2 2010-10-23 11:38:03

kromonos
Member
From: Trier
Registered: 2010-06-12
Posts: 41
Website

Re: [MOD] Stick First Post - 1.0.2

very nice mod .. thank you for this work smile


uhuC - German IT Board ... FluxBB Powered smile

Offline

#3 2010-11-01 22:54:50

kyles
Member
Registered: 2010-10-29
Posts: 14

Re: [MOD] Stick First Post - 1.0.2

i keep getting unexpected t_else
Parse error: parse error in C:\xamp\www\viewtopic.php on line 94

Offline

#4 2010-11-02 02:44:25

Visman
Member
From: Siberia
Registered: 2010-07-10
Posts: 1,209
Website

Re: [MOD] Stick First Post - 1.0.2

Your lines 90-100 write to post

Offline

#5 2010-11-02 07:53:32

kyles
Member
Registered: 2010-10-29
Posts: 14

Re: [MOD] Stick First Post - 1.0.2

if (!$pun_user['is_guest'])
    $result = $db->query('SELECT t.stick_fp, t.subject, t.closed, t.num_replies, t.sticky, t.first_post_id, 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.stick_fp, t.subject, t.closed, t.num_replies, t.sticky, t.first_post_id, 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());
else
    $result = $db->query('SELECT t.subject, t.closed, t.num_replies, t.sticky, t.first_post_id, 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); 

Last edited by kyles (2010-11-02 07:54:06)

Offline

#6 2010-11-02 08:14:17

Visman
Member
From: Siberia
Registered: 2010-07-10
Posts: 1,209
Website

Re: [MOD] Stick First Post - 1.0.2

What is it?

if (...)
...
else
...
else
...

I wrote

#
#---------[ 8. 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, t.first_post_id, 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, t.first_post_id, 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());

#
#---------[ 9. REPLACE WITH ]-------------------------------------------------
#

// Fetch some info about the topic
if (!$pun_user['is_guest'])
    $result = $db->query('SELECT t.stick_fp, t.subject, t.closed, t.num_replies, t.sticky, t.first_post_id, 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.stick_fp, t.subject, t.closed, t.num_replies, t.sticky, t.first_post_id, 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());

Offline

#7 2011-01-03 06:12:58

Visman
Member
From: Siberia
Registered: 2010-07-10
Posts: 1,209
Website

Re: [MOD] Stick First Post - 1.0.2

v 1.0.1
Change for compatibility with mine Poll.

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

// StickFP
$stick_fp_flag = ($cur_topic['stick_fp'] != 0 || (isset($cur_topic['poll_type']) && $cur_topic['poll_type'] > 0));
$stick_fp_start_from = 0;
if ($stick_fp_flag)
    $post_ids[] = $cur_topic['first_post_id'];
// StickFP

Offline

#8 2011-02-10 17:52:31

Visman
Member
From: Siberia
Registered: 2010-07-10
Posts: 1,209
Website

Re: [MOD] Stick First Post - 1.0.2

v 1.0.2
For FluxBB 1.4.4

Offline

#9 2011-03-23 15:56:57

Visman
Member
From: Siberia
Registered: 2010-07-10
Posts: 1,209
Website

Re: [MOD] Stick First Post - 1.0.2

v 1.0.2 - Supports FluxBB: 1.4.4, 1.4.5

Offline

#10 2011-03-24 11:37:55

053+
Member
From: West London, GB
Registered: 2011-02-08
Posts: 205

Re: [MOD] Stick First Post - 1.0.2

Visman, could you explain more to me what this mod does please? Thank you! smile


New project coming 2013. Graphic designer & (amateur) web developer.
Got a CSS question? I'll do my best to help!

Offline

#11 2011-03-24 12:08:46

Visman
Member
From: Siberia
Registered: 2010-07-10
Posts: 1,209
Website

Re: [MOD] Stick First Post - 1.0.2

053+ wrote:

Visman, could you explain more to me what this mod does please? Thank you! smile

36ec783b2a258702b8531608660353e2.jpg

Offline

#12 2011-03-27 23:45:21

053+
Member
From: West London, GB
Registered: 2011-02-08
Posts: 205

Re: [MOD] Stick First Post - 1.0.2

Ah got you, thanks!


New project coming 2013. Graphic designer & (amateur) web developer.
Got a CSS question? I'll do my best to help!

Offline

#13 2013-08-19 12:19:46

Visman
Member
From: Siberia
Registered: 2010-07-10
Posts: 1,209
Website

Re: [MOD] Stick First Post - 1.0.2

v1.0.2 work in FluxBB 1.5.4.

Offline

#14 2015-01-24 05:16:04

Visman
Member
From: Siberia
Registered: 2010-07-10
Posts: 1,209
Website

Re: [MOD] Stick First Post - 1.0.2

Works in FluxBB 1.5.8.

Offline

Board footer

Powered by FluxBB