bitrocker wrote:

is it possible to restrict forum access/visibility to selected forums by member group?

Admin menu > Forums > Edit

bitrocker wrote:

2. is there a way to make some topics stick to top?

The sticky link appears at the bottom of the topic.

377

(3 replies, posted in PunBB 1.2 bug reports)

Offhand, I'd guess that it's probably counting all the posts that the guest can read; For User1, this is adding up to zero.

I would call this a feature/mod request, not a bug.

378

(5 replies, posted in PunBB 1.2 troubleshooting)

hcgtv wrote:

For manipulating your databases: http://www.phpmyadmin.net/

In addition to phpMyAdmin, I use CocoaMySQL (SBG) and MySQL Administrator. (I occasionally use MySQL Query Browser, but I don't think it's very good yet.)

Edit: Don't forget about the documentation: Post-Installation Setup and Testing

Found links in this thread? is this it?

http://www.uus4u.com/download/modules/s … -1.0.4.zip

robertdjung wrote:

anyone with a .12 install got this working?

I do; It works great for me. I don't think I had to do anything special either (just followed the readme).

Mark wrote:

seems to work fine for me hmm

What Kato said.

Direct link: http://www.punres.org/download.php?id=388

The requested file does not exists.

nico_somb wrote:

the last version is released!

http://www.punres.org/viewtopic.php?id=1541

Bad request. The link you followed is incorrect or outdated.

##
##
##        Mod title:  Edit Post Time
##
##      Mod version:  1.2
##   Works on PunBB:  1.2.* (Only tested on 1.2.12)
##     Release date:  2006-07-09
##           Author:  guardian34 (publicbox@fmguy.com)
##
##      Description:  Provides admins and moderators a way to change the date
##                    and time of their posts. (Only works with silent edits.)
##
##   Affected files:  edit.php
##
##       Affects DB:  no
##
##  Version History:
##              1.2:  Proper timezone support, bugfix
##              1.1:  Tries to account for timezone difference, bugfix
##              1.0:  Initial release
##
##       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.
##
##

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

You could just find this line in viewforum.php?

    $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>';

?and replace it with this:

$subject_new_posts = null;

Could you use mod_rewrite to send ?/forums? to viewforum.php?

JoshDavis wrote:

If it is okay to remove the copyright, I would like to do that because I do not like outbound links.

Do you mean the actual hyperlink to PunBB? Regardless, the "ok" part is up to Rickard.

Smartys wrote:

Subselects are supported in MySQL 4.1 and greater?

The other installation uses MySQL 4.0.*. hmm

Thanks, Smartys.

Edit: Now everything seems to be updated expect for the index page?

This works for me on one installation but not another. Any thoughts?

if (isset($_POST['up_poster']))
{
    $result = $db->query('UPDATE '.$db->prefix.'topics SET poster = \''.$new_user.'\' WHERE id = '.
        '(SELECT topic_id FROM '.$db->prefix.'posts WHERE id = '.$post_id.')');
    if ($db->affected_rows() < 1)
        $results .= 'The topic poster was <b>not</b> updated.<br />';
    else
        $results .= 'The topic poster was updated successfully.<br />';
}
Smartys wrote:

The function takes only 2 parameters

I thought it took three, but I realized that two should work.

Now I'm trying to check if the topic author needs to be updated.

FYI, I realized that I may also need to update information for the topic author or last poster.

Smartys wrote:

Yes, all values that should be numbers should have intval run on them and all strings should have $db->escape run on them

Done, thanks.

Kind of, I believe you can use $db->affected_rows

That always returns 0. Edit: Nevermind, mistake on my part.

Does this look better?

    // Make sure post id was entered
    if (trim($_POST['id_post']) == '')
        message('You didn\'t enter a post id!');

    // Make sure user id was entered
    if (trim($_POST['id_user']) == '')
        message('You didn\'t enter an user id!');

    $_POST['id_post'] = intval($_POST['id_post']);
    $_POST['id_user'] = intval($_POST['id_user']);

    // Check for valid user id and get new username
    $result = $db->query('SELECT username FROM '.$db->prefix.'users WHERE id = '.$_POST['id_user']);
    $result = $db->result($result, 0, 0);
    if ($result == '')
        message('User id '.$_POST['id_user'].' wasn\'t found.');

    // Update post!
    $db->query('UPDATE '.$db->prefix.'posts SET '.'poster=\''.$result.'\', '.'poster_id='.$_POST['id_user'].' WHERE id = '.$_POST['id_post']);
    if ($db->affected_rows() < 1)
        $result = 'No updates were made.';
    else
        $result = 'The update was successful. '.
            '(Post: <a href="viewtopic.php?pid='.$_POST['id_post'].'">'.$_POST['id_post'].'</a>;'.
            ' User: <a href="profile.php?id='.$_POST['id_user'].'">'.$_POST['id_user'].'</a>)';

    // Display the admin navigation menu

My first attempt at a PunBB plugin? it modifies the author (poster and poster_id) for a given post (id).

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

  Copyright (C) 2006  guardian34 (publicbox@fmguy.com)

  This file is part of PunBB.

  PunBB is free software; you can redistribute it and/or modify it
  under the terms of the GNU General Public License as published
  by the Free Software Foundation; either version 2 of the License,
  or (at your option) any later version.

  PunBB is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  MA  02111-1307  USA

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

// Make sure no one attempts to run this script "directly"
if (!defined('PUN'))
    exit;

// Tell admin_loader.php that this is indeed a plugin and that it is loaded
define('PUN_PLUGIN_LOADED', 1);

if (isset($_POST['update']))
{
    // Make sure post id was entered
    if (trim($_POST['id_post']) == '')
        message('You didn\'t enter a post id!');

    // Make sure user id was entered
    if (trim($_POST['id_user']) == '')
        message('You didn\'t enter an user id!');

    // Check for valid post id
    $result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE id = '.$_POST['id_post']);
    $result = $db->fetch_assoc($result);
    if (!$result['id'])
        message('Post id '.$_POST['id_user'].' wasn\'t found.');

    // Check for valid user id and get new username
    $result = $db->query('SELECT username FROM '.$db->prefix.'users WHERE id = '.$_POST['id_user']);
    $result = $db->fetch_assoc($result);
    if (!$result['username'])
        message('User id '.$_POST['id_user'].' wasn\'t found.');

    // Update post
    $db->query('UPDATE '.$db->prefix.'posts SET '.
        'poster=\''.$result['username'].'\', '.
        'poster_id='.$_POST['id_user'].' WHERE id = '.$_POST['id_post']);

    // Display the admin navigation menu
    generate_admin_menu($plugin);
?>
    <div class="block">
        <h2><span>Post Author Update - v1.0</span></h2>
        <div class="box">
            <div class="inbox">
                <p>This plugin modifies the author (poster and poster_id) for a given post (id).</p>
            </div>
        </div>
    </div>
        
    <div class="block">
        <h2 class="block2"><span>Result</span></h2>
        <div class="box">
            <div class="inbox">
                <p>The update was successful. 
                    (Post: <a href="viewtopic.php?pid=<?php echo $_POST['id_post'] ?>"><?php echo $_POST['id_post']; ?></a>;
                     User: <a href="profile.php?id=<?php echo $_POST['id_user']; ?>"><?php echo $_POST['id_user']; ?></a>)</p>
            </div>
        </div>
    </div>
<?php
}
else
{
    // Display the admin navigation menu
    generate_admin_menu($plugin);
?>
    <div class="block">
        <h2><span>Post Author Update - v1.0</span></h2>
        <div class="box">
            <div class="inbox">
                <p>This plugin modifies the author (poster and poster_id) for a given post (id).</p>
            </div>
        </div>
    </div>
        
    <div class="blockform">
        <h2 class="block2"><span>Input</span></h2>
        <div class="box">
            <form method="post" action="<?php echo $_SERVER['REQUEST_URI'] ?>">
                <div class="inform">
                    <fieldset>
                        <legend>IDs</legend>
                        <div class="infldset">
                            <table class="aligntop" cellspacing="0">
                                <tr>
                                    <th scope="row">Post ID:</th>
                                    <td><input type="text" name="id_post" size="16" /></td>
                                </tr>
                                <tr>
                                    <th scope="row">User ID:</th>
                                    <td><input type="text" name="id_user" size="16" /></td>
                                </tr>
                            </table>
                        </div>
                    </fieldset>
                </div>
            <p class="submitend"><input type="submit" name="update" value="Update" /></p>
            </form>
        </div>
    </div>
<?php
}
// Note that the script just ends here. The footer will be included by admin_loader.php.
?>

Being fairly new to both PHP and PunBB, I have a couple of concerns. First, should the input be run through any filtering? Second, can I use the UPDATE query result to determine if the post id is valid?