I'll use the How-to. That seems easier to me. Thanks. Well, off to smiley-ize my forum. wink

Well then how should I add smileys? What's AP and what's AMP mean? I just need to put my smilies back in. My members deserve it. I came from phpBB where adding more was easy as pie.

Also, is it Smileys or Smilies?

I'm sorry, but this is all screwed up. The Installer is broken. sad

The first error I get is on line 12:
Parse error: parse error, unexpected ',', expecting ')' in /home/jasoco/public_html/geekpub/plugins/install_mod.php on line 12

After I fix that error, another pops up further down.
Parse error: parse error, unexpected ';' in /home/jasoco/public_html/geekpub/plugins/install_mod.php on line 33

Then after I fix THAT one ANOTHER one pops up. I hope you fix it soon.

Edit: Wait. I think I fixed it. There is an extra comma on line 12 and two extra semicolons on line 33 and 44. Remove all three and it seems to load right.

That worked! Thanks! I'm still learning all the MySQL access stuff so pardon my ignorance.

I'm trying to Modify a MOD I installed last night.

Active Topics: http://punbb.org/forums/viewtopic.php?id=4160

I'd post this there, but that thread seems really dead and I'm sure this question could be answered here too.

It seems the MOD as it is has no way of retrieving the name of the forum a topic is attached to. It does have the ID number of course. So as it is, I am able to display the ID number of the forum the active topics are attached to. But I want to take that number and convert it into its equivalent real name. I hope that was clear. Obviously I'm going to have to add some code to read the database. But I don't know enough about getting table names and stuff to know where to start in that regard.

Here is the code I have as it is. It's highly modified from what is available in that thread.

<?php

$active_topic_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) AND t.moved_to IS NULL ORDER BY t.last_post DESC    LIMIT '.$active_topic_limit) or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());

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

?>
<div id="vf" class="blocktable">
    <h2><span>Active Topics</span></h2>
    <div class="box">
        <div class="inbox">
            <table cellspacing="0">
            <thead>
                <tr>
                    <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))
{
    while ($cur_topic = $db->fetch_assoc($result))
    {
        $item_status = '';

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

        $last_post = '<a href="viewtopic.php?pid='.$cur_topic['last_post_id'].'#p'.$cur_topic['last_post_id'].'">'.pun_htmlspecialchars($cur_topic['subject']).'</a>';

        if (!$pun_user['is_guest'] && $cur_topic['last_post'] > $pun_user['last_visit'])
        {
            $item_status .= ' inew';
            $last_post = '<strong>'.$last_post.'</strong>';
        }

        if ($cur_topic['sticky'] == '1')
        {
            $last_post = '<span class="stickytext">'.$lang_forum['Sticky'].': </span>'.$last_post;
            $item_status .= ' isticky';
        }
?>
                 <tr<?php if ($item_status != '') echo ' class="'.$item_status.'"'; ?>>
                    <td class="tcl">
                        <div class="intd">
                            <!--<div class="<?php echo $icon_type ?>"><div class="nosize"><?php echo $icon_text ?></div></div>//-->
                            <div class="tclcon">
                                <?php echo $last_post.' in '.pun_htmlspecialchars($cur_topic['forum_id']); ?>
                            </div>
                        </div>
                    </td>
                    <td class="tc2"><?php echo $cur_topic['num_replies']; ?></td>
                    <td class="tc3"><?php echo $cur_topic['num_views']; ?></td>
                    <td class="tcr"><?php echo format_time($cur_topic['last_post']); ?> by <?php echo pun_htmlspecialchars($cur_topic['last_poster']); ?></td>
                </tr>
                               
<?php
    }
}
else
{
?>
                <tr>
                    <td class="tcl" colspan="4"><?php echo '*EMPTY*' ?></td>
                </tr>
<?php

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

And here is my Forum. The Active Topic table is at the bottom of the page.
http://www.jasoco.net/geekpub/index.php
Note the numbers next to the topic names. I want to take those numbers and turn them into their forum names.

The line <?php echo $last_post.' in '.pun_htmlspecialchars($cur_topic['forum_id']); ?> is the problem. I want to take $cur_topic['forum_id'] and wrap it in another array that returns the forum name.

Thanks for any help. smile

Awesome! I spent hours last night trying to make a Mod to my forum like this and failed spectacularly.

http://www.jasoco.net/geekpub/
big_smile

I installed this last night. It works great! Awesome mod.

Here's another MOD for the User List. Sorting by Karma.

This one was tricky for someone like me who is still learning PHP, but here goes:

First find line ~46. Change it from:

$sort_by = (!isset($_GET['sort_by']) || $_GET['sort_by'] != 'username' && $_GET['sort_by'] != 'registered' && ($_GET['sort_by'] != 'num_posts' || !$show_post_count)) ? 'username' : $_GET['sort_by'];

To:

$sort_by = (!isset($_GET['sort_by']) || $_GET['sort_by'] != 'username' && $_GET['sort_by'] != 'registered' && $_GET['sort_by'] != 'karma' && ($_GET['sort_by'] != 'num_posts' || !$show_post_count)) ? 'username' : $_GET['sort_by'];

Next simply add:

<option value="karma"<?php if ($sort_by == 'karma') echo ' selected="selected"' ?>>Karma</option>

Below the:

<?php if ($show_post_count): ?>                        <option value="num_posts"<?php if ($sort_by == 'num_posts') echo ' selected="selected"' ?>><?php echo $lang_ul['No of posts'] ?></option>

Line. (This line should be ~89. So the added line will end up being 90.)

Congratulations, now you can sort the User List by how much Karma they have.

Installed! Works great. big_smile

"..and I helped!"

You are welcome!

Edit: A neat suggestion I can think of would be to make it so Admins and Moderators can give users Karma without a 24 hour limit while the other users would have the limit.

No, I figured it out. Except that I put it inside the Is User part. I'll move it though.

Also check out my above User List modification. Feel free to use it for the MOD.

Check it out!
http://www.jasoco.net/geekpub/userlist.php

I think next I'm going to see if I can add the Karma value to the users profile. As well as an editable box for the Admins.

I think I got it working. Fortunately I'm able to understand code and see it in my head most of the time. The Readme has the code placement in the wrong place! That last part should be put inside the { } brackets that have the comment of "// If the poster is a registered user.". The Readme has the placement on line ~266 after a part of the code that is inside the "Guest" Ie...Else statement.

I reuploaded, refreshed the page and tested the links. They're working now.

FYI to the author to make that last part more clear.

Edit: I have also added a simple modification to display the users Karma on the User List page.

It's pretty easy. Open Userlist.php and do the following.

Find the line:

                <th class="tc2" scope="col"><?php echo $lang_common['Title'] ?></th>

And add the following after it:

                <th class="tc3" scope="col">Karma</th>

Find the following:

                    <td class="tc2"><?php echo $user_title_field ?></td>

And add the following after it:

                    <td class="tc3"><?php echo $user_data['karma'] ?></td>

Then lastly find the line that begins:

$result = $db->query('SELECT u.id, u.username,

And modify it to include "u.karma, " before the "u.id" so it looks like this:

$result = $db->query('SELECT u.karma, u.id, u.username,

You will now have a Karma column in the User List.

There's supposed to be some code in the ViewTopic.php file that adds those two links.

I checked and yes I did put the code in. For some reason it's not accepting it. sad

I tried installing again and it says it was already installed so it's there but it's not working.

So it definitely has something to do with th part starting:

if ($cur_post['poster_id'] > 1&&!$pun_user['is_guest'])

Can you check your php file (The actual file, not the source of the page in your browser) and tell me what that's supposed to be? It's not validating the user as a user. As if it is thinking everyone's a guest.

I installed this but it doesn't show the "Praise" and "Smite" links in the posts? I ran the install file. I copied all the code in. It doesn't give me any errors at all. It does show "Karma: 0" in everyones posts, but the links don't show up to actually praise or smite people.

What did I do wrong? Can Admins not see the links?

http://www.jasoco.net/geekpub/viewtopic.php?id=13

I want to take it a piece at a time.

First step I want to do it place into my template the code to connect to the punBB database then recieve information about the forum, display a login section (Into the page itself, not a link to another page. But if I have to, a link to another page where you can login then return to the main page of the site.) in the sidebar, display other information about threads and new users and stuff.

I can do the bulk coding stuff, but I'm having trouble getting started.

I've followed that "How to" on the documentation page:
http://punbb.org/docs/dev.html

But the first problem I ran into was requiring the common.php file. I typed:

define('PUN_ROOT', './geekpub/');
require PUN_ROOT.'include/common.php';

to start with but it gave me errors:
Parse error: parse error, unexpected T_STRING in /home/jasoco/public_html/wp-content/themes/Jasoco/header.php on line 2
After playing around, I find that it's not accepting "./geekpub/" as the path. I hard code the actual path to the file into the "require" line and end up with:

define('PUN_ROOT', '/home/jasoco/public_html/geekpub/');
define('PUN_TURN_OFF_MAINT', 1);
define('PUN_QUIET_VISIT', 1);
echo PUN_ROOT;
require PUN_ROOT.'include/common.php';

But it doesn't work. I get:
Fatal error: Cannot redeclare unregister_globals() (previously declared in /home/jasoco/public_html/wp-settings.php:4) in /home/jasoco/public_html/geekpub/include/functions.php on line 1034

The "echo" line is for debugging. It shows that the PUN_ROOT variable is being set correctly. (When the page is loaded, it prints the variable right before the error appears which shows that A) the error occurs after the echo line and B) that it's the Require line causing problems.

If I comment out the require line it loads fine. The page shows normally (With the echo'd PUN_ROOT printed at the top of the page.)

So you can see my problem is clear. This code is contained in my WordPress theme's "header.php" file. This file is contained under "/wp-content/themes/Jasoco/". It's also the first line at the top of the outputted code.

I tried putting my new punBB code in other files including WP's own index.php file (Contained at the root of the site.) but it does the same error anyway.

I must be doing something wrong.

Any help?

Edit: Apparently the forum software includes function with the same name as a function in WordPress. unregister_globals()

ITo remedy I tried renaming all occurrences (All two of them) from unregister_globals() to unregister_globals_pun() but that didn't work. It gives me a new error: Fatal error: Call to a member function on a non-object in /home/jasoco/public_html/geekpub/include/functions.php on line 110
But apparently this function isn't needed by the actual forum because even with that function renamed, the forum still works fine. So obviously unregister_globals() is only used for integration purposes.

41

(4 replies, posted in PunBB 1.2 troubleshooting)

Pretty much any browser has that feature actually. You just need to select the one you want to delete.