I run a forum for tournaments and I have a special subforum for quick matches against other memebers who are online at the time.  I'd like for a script to automatically generate a topic in the subforum at the start of every day at midnight, then once the next day begins at midnight, move the previous topic to a seperate subforum for archiving.

Would this be possible :?

2

(3 replies, posted in PunBB 1.2 show off)

I like it smile

I can understand the google ads, as I'm a garage developer, and my ads are pretty much my income.

I'm viewing it in Flock (Firefox clone) and it looks wonderful.

Hmm, that sounds like a good idea.

Since they are going to be able to modify the karma manually, they might as well be able to praise/smite relatively without having to go into the users' profile.

I'm working on modding profile.php to have karma in the administration section of the menu.

Edit:
Okay, that was harder than I thought.

I've released 1.0.3, which features adminstrators able to manually change the users' karma from the profile menu.

Also, don't forget to reupload karma.php, I've changed it to allow administrators to praise/smite users without the time restriction.

More suggestions are appreciated smile

I've released 1.0.2, to include Jasoco's userlist.php modification, thanks Jasoco smile

I was going to get around to it, really tongue

The demo forum has been upgraded to 1.0.2

No no, it's placed in the right spot.  Or at least, it will work where it's at.

    // If the poster is a guest (or a user that has been deleted)
    else
    {
        $username = pun_htmlspecialchars($cur_post['username']);
        $user_title = get_title($cur_post);

        if ($pun_user['g_id'] < PUN_GUEST)
            $user_info[] = '<dd>IP: <a href="moderate.php?get_host='.$cur_post['id'].'">'.$cur_post['poster_ip'].'</a>';

        if ($pun_config['o_show_user_info'] == '1' && $cur_post['poster_email'] != '' && !$pun_user['is_guest'])
            $user_contacts[] = '<a href="mailto:'.$cur_post['poster_email'].'">'.$lang_common['E-mail'].'</a>';
    }
    
    if ($cur_post['poster_id'] > 1&&!$pun_user['is_guest'])    
        $post_actions[] = '<li class="postedit">Karma: <a href="karma.php?post='.$cur_post['id'].'&vote=1">'.'Praise user'.'</a> - <a href="karma.php?post='.$cur_post['id'].'&vote=0">'.'Smite user'.'</a>';

    // Generation post action array (quote, edit, delete etc.)

That's how it should look.

The Readme has the placement on line ~266 after a part of the code that is inside the "Guest" Ie...Else statement.

Here's part of the readme.txt:

#
#---------[ 10. FIND (line: 266) ]--------------------------------------------
#

        if ($pun_config['o_show_user_info'] == '1' && $cur_post['poster_email'] != '' && !$pun_user['is_guest'])
            $user_contacts[] = '<a href="mailto:'.$cur_post['poster_email'].'">'.$lang_common['E-mail'].'</a>';
    }

It has the bracket in the part where you should be searching for, so you should place it after that.

If you guys are still having problems and this doesnt fix it, let me know.

And you're positive you ran the install_mod.php file?

Edit:  Oops, derp.  I know the problem.

<?php
$result = $db->query ('SELECT id, username, karma FROM '.$db->
prefix.'users ORDER BY karma DESC LIMIT 10') 
or error('Unable to fetch user data', __FILE__, __LINE__, $db->error());
while ($data = $db->fetch_assoc($result))
{
echo "".'<a href="profile.php?id='.$data['id'].'">'.pun_htmlspecialchars($data['username']).'</a> ('.$data['karma'].') '."\n";
}
?>

Replace it with that.

The golden coins are the alias I set as cash, for the cashmod.

@HitMan

Try this...

<?php
$result = $db->query ('SELECT id, username, karma FROM'.$db->
prefix.'users ORDER BY karma DESC LIMIT 10') 
or error('Unable to fetch user data', __FILE__, __LINE__, $db->error());
while ($data = $db->fetch_assoc($result))
{
echo "".'<a href="profile.php?id='.$data['id'].'">'.pun_htmlspecialchars($data['username']).'</a> ('.$data['karma'].') '."\n";
}
?>

8

(5 replies, posted in General discussion)

The mods that work with 1.2.4 will probably work with 1.2.10

##
##
##        Mod title:  Karma Mod
##
##      Mod version:  1.0.3
##   Works on PunBB:  1.2.*
##     Release date:  2006-01-15
##           Author:  Trevor Slocum (tslocum@gmail.com)
##
##      Description:  Adds the ability for your users to praise/smite each other.
##
##   Affected files:  viewtopic.php
##                    userlist.php
##                    profile.php
##
##       Affects DB:  Yes
##
##
##       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.
##
##

This mod lets users give/take away karma from each other.

Right now it's extremely basic, since I'm brand new to the PunBB modding community, but I am working on it as an ongoing project.

Download it at http://punres.org/files.php?pid=166

I have a demo set up at http://karmaforum.pun.tj9991.com/

And, I am using it on my main forum at http://www.mkdsc.com/

I started this because I was looking for a karma mod, but when I found one, it looked like it was abandoned.

Hope you guys like it smile

Thanks Steven, that fixed it smile

I wanted an easy way for people to see if they had any new messages, so here is what I did

I have miniportal, so I decided to make it a block, but you could apply the code to anything

First I added a entry to the messages table to store whether or not they have viewed the message yet

ALTER TABLE `pun_messages` ADD `read` TINYINT( 1 ) DEFAULT '0' NOT NULL ;

Make sure you replace pun_messages with whatever your messages table is, if it is different

Second, I modified the template file so it would know I want a block there.

Open up include/functions.php and add the following at the very end of the file:

//
// Generate the messages block
//
function generate_messagesblock()
{
    global $pun_config, $lang_common, $pun_user, $db;
    
    $messages_return = "";
    
    if (!$pun_user['is_guest']) {
        $result = $db->query('SELECT count(*) FROM '.$db->prefix.'messages WHERE status=0 AND owner='.$pun_user['id']) or error('Unable to count messages', __FILE__, __LINE__, $db->error());
        list($num_messages) = $db->fetch_row($result);
        
        $result = $db->query('SELECT count(*) FROM '.$db->prefix.'messages WHERE `read`=0 AND status=0 AND owner='.$pun_user['id']) or error('Unable to count unread messages', __FILE__, __LINE__, $db->error());
        list($num_messages_unread) = $db->fetch_row($result);
        
        $messages_return .= "You currently have <b>".$num_messages."</b> messages, of which ";
        
        if ($num_messages_unread>0) {
            $messages_return .= "<font color=\"red\">";
        }
        
        $messages_return .= "<b>".$num_messages_unread."</b> are new";
        
        if ($num_messages_unread>0) {
            $messages_return .= "</font>";
        }
        
        $messages_return .= ".<br><a href=\"message_list.php\">Click here to view them</a>.";
    } else {
        $messages_return .= "Please log in to check your messaging status.";
    }

    return $messages_return;
}

Then open include/template/main.tpl, and find this:

    <div class="block">
        <h2><span>Menu</span></h2>
        <div class="box">
        <pun_sidelinks>            
        </div>
    </div>

After it, add:

    <div class="block">
        <h2 class="block2"><span>Messages</span></h2>
        <div class="box">
            <div class="inbox">
                <pun_messagesblock>
            </div>
        </div>
    </div>

Then open header.php, and find this:

// START SUBST - <pun_sidelinks>
$tpl_main = str_replace('<pun_sidelinks>','<div class="inbox">'."\n\t\t\t". generate_navlinks()."\n\t\t".'</div>', $tpl_main);
// END SUBST - <pun_sidelinks>

After it, add:

// START SUBST - <pun_messagesblock>
$tpl_main = str_replace('<pun_messagesblock>','<div class="inbox">'."\n\t\t\t". generate_messagesblock()."\n\t\t".'</div>', $tpl_main);
// END SUBST - <pun_messagesblock>

Now open message_list.php, and find this:

    // Do signature parsing/caching
    if (isset($cur_post['signature']) && $pun_user['show_sig'] != '0')
    {
        $signature = parse_signature($cur_post['signature']);
    }

After it, add:

    //Mark it as read
    $result = $db->query('UPDATE '.$db->prefix.'messages SET `read`=1 WHERE id='.$id) or error('UPDATE '.$db->prefix.'messages SET read=1 WHERE `id`='.$id.'Unable to set message as read', __FILE__, __LINE__, $db->error());

And that's it.  Save and upload header.php, message_list.php, include/functions.php, and include/template/main.tpl

Right now message_list.php doesnt make the message title look any different if its unread, I just wanted to keep it simple

If this is completely useless to everyone, sorry :X

I've got Miniportal installed at http://www.mkdsc.com/index.php

http://img296.imageshack.us/img296/7910/mkdscscreen18tg.th.jpg

http://img296.imageshack.us/img296/4369/mkdscscreen20cf.th.jpg

In the first screenshot, look at the first news entry.  That was a reply of a members, not the original thread post.

In the second shot, the same thing happens.

My index.php

<?php
 
define('PUN_ROOT', './');
//define('PUN_QUIET_VISIT', 1);
require PUN_ROOT.'include/common.php';
 
$page_title = pun_htmlspecialchars($pun_config['o_board_title']);
define('PUN_ALLOW_INDEX', 1);
require PUN_ROOT.'header.php';
require PUN_ROOT.'include/parser.php';

function pun_news($fid='', $show=15, $truncate=1)
{
    global $lang_common, $db, $pun_config, $db_prefix;
    $max_subject_length = 30;
    $show_max_topics = 50;
    $fid = intval($fid);
    $order_by = 't.posted';
    $forum_sql = '';
    // Was a forum ID supplied?
    if ( $fid ) $forum_sql = 'f.id='.$fid.' AND ';
    $show = intval($show);
    if ($show < 1 || $show > $show_max_topics)
    $show = 15;
    $saveddate="";
    // Fetch $show topics
    $result = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.last_post, f.id AS fid, f.forum_name FROM '.$db_prefix.'topics AS t INNER JOIN '.$db_prefix.'forums AS f ON t.forum_id=f.id WHERE f.id='.$fid.' AND t.moved_to IS NULL ORDER BY '.$order_by.' DESC') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
    $show_count = 0;
    if ( !$db->num_rows($result) ) return $output;
    while ( ($show_count < $show) && ($cur_topic = $db->fetch_assoc($result)) ) {
        $temp = '';
        if ($pun_config['o_censoring'] == '1')
            $cur_topic['subject'] = censor_words($cur_topic['subject']);
        if (pun_strlen($cur_topic['subject']) > $max_subject_length)
            $subject_truncated = trim(substr($cur_topic['subject'], 0, ($max_subject_length-5))).' ...';
        else
            $subject_truncated = $cur_topic['subject'];
        $newsheading = '<a href="'.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_topic['id'].'&action=new" title="'.pun_htmlspecialchars($cur_topic['subject']).'">'.pun_htmlspecialchars($subject_truncated).'</a> - <em>Posted by '.$cur_topic['poster'].' at '.date('h:i A', $cur_topic['posted']).'</em><br>';
        // Group posts by date    
        $thisdate = date('l, d F Y', $cur_topic['posted']);
        if ($thisdate != $saveddate) 
 
        {
            if ($saveddate)
            {
                $temp .= "</div></div>";
            }
            $temp .= '<div class="block"><h2><span>'.$thisdate.'</span></h2><div class="box"><div class="inbox"><p>';
            $saveddate = $thisdate;
        }
        else {
            $temp .= '<div class="inbox"><p>';
        }
        $temp .= $newsheading.'</p><p>';
        $id = $cur_topic['id'];
        $msg = $db->query('SELECT id, poster, poster_id, poster_ip, poster_email, message, posted, edited, edited_by FROM '.$db_prefix.'posts WHERE topic_id='.$id.' LIMIT 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
            if ( !$db->num_rows($msg) ) continue;
        $cur_post = $db->fetch_assoc($msg);
        // Display first paragraph only (comment out next four lines to turn off)
        if ($truncate == 1)
        {
        $paragraph = preg_split("/s*n+/", $cur_post['message']);
            if (isset($paragraph[1])) {
                $cur_post['message'] = $paragraph[0] . "...";
            }
        }
        $cur_post['message'] = parse_message($cur_post['message'], 0);
        $temp .= $cur_post['message'];
        $temp .= "</p></div>";
        if (isset($output)) {
            $output .= $temp;
        }
        else {
            $output = $temp;
        }
        ++$show_count;
    } // end of while
    $output .= "</div></div>";
    return $output;
}

?>
        <div class="block">
            <h2><span>Welcome</span></h2>
            <div class="box">
                <div class="inbox">
                    <p>
                    Welcome to Mario Kart: DS Central.  To visit the Forums, please select "Forum" from the menu to the left, or the top navigation bar.
                    </p>
                </div>
            </div>
        </div>
<?php
echo pun_news(12, 7, 0);
 
require PUN_ROOT.'footer.php';

I haven't modified the function's code, so I don't know what could be causing this sad

Other than this problem, it seems to be working fine, great work smile

13

(7 replies, posted in PunBB 1.2 show off)

I've only modified the Quicktime theme and used the Miniportal mod, which I haven't changed any to make it bold for the first letter, so that comes with it smile

14

(7 replies, posted in PunBB 1.2 show off)

Well I took your advice and invested in some theming

Due to my horrible lack of skills, I've modified an existing theme with some subtle icons to give the site a Nintendo feel to it

Also, a nice MK: DS header has been added to the top smile

15

(7 replies, posted in PunBB 1.2 show off)

I got rather bored and decided to start a new website, and when I was looking for the right forum software, I found PunBB to look like I wanted my site to.

The website is dedicated to Mario Kart: DS, which is a really fun game for the Nintendo DS

http://www.mkdsc.com/

Right now I'm working on drawing in more members off of advertising and Nintendo forums, so I can set up a few tournaments smile