(20 replies, posted in Feature requests)

solace wrote:

i put mine in main.tpl just before </body> but i'm not having any luck with Google Analytics seeing it, it works on my other sites... not sure...

I'm using 1.3 RC. I did the same, and mine also can't see that the code is installed but it's getting stats back... Really strange.

Has anyone tried tracking usernames with the "User Defined" report?

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
<script type="text/javascript">
var pageTracker = _gat._getTracker("account#No");
echo $forum_user['username'];

This part of the code should track what users are logged-in:

echo $forum_user['username'];

I'm not sure if I've got that code right because it seems to break the stats tracking code altogether. Any suggestions?

UPDATE: Ok I figured-out that you can't really use php in the template main.tpl. I managed to get the above code working by putting it in the footer.php It's ugly, but it works... I hope there's an extension soon to allow custom tracking code.


(4 replies, posted in PunBB 1.3 extensions)

Anatoly wrote:
<?php echo $forum_user['username']; ?>

This doesn't seem to be working; I put the stats javascript into the announcement box... I assume it doesn't support php. Should I edit the header.php to add the stats code? What's the best way to do this until there is an extension? Thanks.


(4 replies, posted in PunBB 1.3 extensions)

Thanks for the code. I was close when I was peeking at the php code.

I've tried the Google Analytics extension, but it doesn't install. I guess I'll just have to wait... Plus it doesn't sound like you can use any custom stats scripts with that extension.

First off, I'm sorry I'm not too php savvy.

I use Reinvigorate and Google Analytics for my stats. They both do different things well so I tend to use both at the same time.

Reinvigorate says the javascript should be put before </head> and Google wants to be right before </body>. I was just wondering what file(s) I should be putting this code in.

I think it should be a feature or extension to be able to paste any stats code into a text box somewhere in the administration.

Also with both services you can track registered users. I was wondering what code I should use to get the current logged-in user's username. Here's the example of the code I've been using with Ning.

$user = XN_Profile::current();
echo "$user->fullName";

What would be the punbb version of this? Thanks!


<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
<script type="text/javascript">
var pageTracker = _gat._getTracker("*****");
$user = XN_Profile::current();
echo "$user->fullName";


<script type="text/javascript" src="http://include.reinvigorate.net/re_.js"></script>
<script type="text/javascript">
// <![CDATA[
var re_name_tag = "<?php
$user = XN_Profile::current();
echo "$user->fullName";
// ]]>


(2 replies, posted in PunBB 1.3 extensions)

Sure let's make it an extension request.


(2 replies, posted in PunBB 1.3 extensions)

I can't remember if it was a hack or built-in to 1.2, but it was really nice to be able to broadcast an email to all the registered users. Is there such a feature or extension for 1.3 yet?



(1 replies, posted in PunBB 1.3 troubleshooting)

When I attempt to delete a user and all their posts I get this error:

Fatal error: Cannot redeclare split_words() (previously declared in /home/****/html/forums/include/search_idx.php:41) in /home/****/html/forums/include/search_idx.php on line 87

I'm running 1.3 RC with all the latest hotfixes. The database was imported and upgraded from a 1.2 install.

I'm getting this error when I try to install it:

Notice: Undefined variable: db in /home/****/html/forums/admin/extensions.php(164) : eval()'d code on line 4

Fatal error: Call to a member function query() on a non-object in /home/****/html/forums/admin/extensions.php(164) : eval()'d code on line 4


(3 replies, posted in PunBB 1.3 troubleshooting)

I've got the same issue on my install.

Well glad you all like the idea. Hopefully someone wants to code it eventually.

sirena wrote:
NetworkShadow wrote:
Dr.Jeckyl wrote:


i was searching if the iPhone had theme capabilities and found this.

I'm a mod on this forum. They've also just updated the layout.

You should have a look at it using IE6 sometime. While it looks great in Opera, Firefox etc, it is a real dogs breakfast in IE6. What a mess. Mainly due to IE PNG non-transparency issues I suspect but perhaps also some bad CSS or JS. The top ad bar has gone completely wonky and the ads literally sit on top of the site logo and the left half of the menu. And the text in the 'Staff Contact Us Powered by PunBB RSS' section is showing up as white on white invisible. And the image background has broken up all over the place too. Etc. Pass it on.

Thanks. Somehow I doubt they care about IE 6, being a Mac forum and all.

Dr.Jeckyl wrote:


i was searching if the iPhone had theme capabilities and found this.

I'm a mod on this forum. They've also just updated the layout.


(8 replies, posted in PunBB 1.3 troubleshooting)

MattF wrote:

If you're definitely running 4.3+, then the only thing I can think is that your host has specifically disabled the tokenizer functions during the compilation of PHP. What does your php info page say in the admin section?

PHP: 5.2.6RC1-pl1-gentoo -
You are right: '--disable-tokenizer'


(8 replies, posted in PunBB 1.3 troubleshooting)

The server admin hasn't gotten back to me yet. If anyone else has any insight it would be welcome. Thanks.


(9 replies, posted in PunBB 1.3 troubleshooting)

hcgtv wrote:
Maxtrix wrote:

Safari 3.1.2 on Mac OS-X 10.5

Get a real browser, just kidding smile

Why not try it with Firefox and see if you get the same results. Often times I experience strange things and fire up Opera or IE to compare, just to be on the safe side.

Another thing you could try is to clear the cookie for this forum and try again. I know I was having some weird things going on when Firefox 3 came out and this forum changed versions, so I cleared everything and started over.

Safari works just fine on the Mac. I'd clear the cookies, and maybe change the cookie settings.


(8 replies, posted in PunBB 1.3 troubleshooting)

Slavok wrote:

Maybe this link will help you

Not really.. I spoke with my server admin and he said that the PHP config should be fine.
And we don't see how the error with zend would relate to my issue, punbb doesn't even have a "Configuration/Extensions" directory. Thanks for trying though.

I'm asking my server admin again. http://us.php.net/manual/en/tokenizer.installation.php


(8 replies, posted in PunBB 1.3 troubleshooting)

My server says it's got PHP 5.2.


(8 replies, posted in PunBB 1.3 troubleshooting)

I just updated my 1.2.17 install to 1.3 RC today.

On the Install Extensions page (/admin/extensions.php?section=install) I get this:

Fatal error: Call to undefined function token_get_all() in /home/*****/domains/*****.com/public_html/forums/include/xml.php on line 212

Any ideas? Thanks!

Hello. I've been playing around with the 1.3 RC today. I've been thinking it would be great if there was an extension for users to easily upload images to an off server hosting service, or services (for choice) like Flickr and Photobucket etc, then automatically place the image BBcode in the message body. It would be very handy.

I know Flickr has an API. I've also seen Photobucket upload widgets on Mac OS X etc. I'm not a programer, but I'd suspect it could be done quite easily.

Well that's my idea. Hope that sparks some discussion and perhaps development.

Great hack. Thanks!

This code doesn't seem to be working. It hasn't been tracking. Any ideas?

Thanks so much!

Cool. Any luck with this? I've been wanting to do the same with my board since I also have a Reinvigorate account. Do you have any code examples? Thanks!

NetworkShadow wrote:


I'm looking for a way to generate an RSS feed of just new threads with the first posts' content, I don't want replies in the feed. Can this be done with a similar RSS mod?


A friend of mine took a crack at my feature requests and the end result works great. Be advised that it searches the entire database for the first post of the newest threads. It might be a bit slow on some large databases.

Here's a modified RSS.php

  * BLOG:CMS: PHP/MySQL Personal Content Management System 
  * http://blogcms.com/
  * http://forum.blogcms.com/
  * 2003-2004, (c) Radek HULAN 
  * http://hulan.cz/
  * Mod by Bert Garcia for PunBB 1.2.1
  * http://nupusi.com
  * Additional changes Copyright 2005 by Alex King
  * Now creates feeds for categories, forums, topics
  * http://www.alexking.org/software/
  * Modified by Daniel Jalkut to eliminate redundant Topic and 
  * Message prefixes is the description output, and to include
  * content in a content:encoded namespace for better formatting
  * preservation. http://www.red-sweater.com/.
  * Please see the enclosed readme.txt file for usage
  * This program 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.

// **********************************************************************
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// *****************************************************************


define('PUN_ROOT', './');
@include PUN_ROOT.'config.php';

// If PUN isn't defined, config.php is missing or corrupt
if (!defined('PUN'))
    exit('The file \'config.php\' doesn\'t exist or is corrupt. Please run install.php to install PunBB first.');

// Disable error reporting for uninitialized variables
error_reporting(E_ERROR | E_WARNING | E_PARSE);

// Turn off magic_quotes_runtime

// Load the functions script
require PUN_ROOT.'include/functions.php';
require PUN_ROOT.'include/parser.php';

// Load DB abstraction layer and try to connect
require PUN_ROOT.'include/dblayer/common_db.php';

// Get the forum config
$result = $db->query('SELECT * FROM '.$db->prefix.'config') or error('Unable to fetch forum config', __FILE__, __LINE__, $db->error());
while ($cur_config_item = $db->fetch_row($result))
    $pun_config[$cur_config_item[0]] = $cur_config_item[1];

// Make sure we (guests) have permission to read the forums
$result = $db->query('SELECT g_read_board FROM '.$db->prefix.'groups WHERE g_id=3') or error('Unable to fetch group info', __FILE__, __LINE__, $db->error());
if ($db->result($result) == '0')
    exit('No permission');

// Attempt to load the common language file
@include PUN_ROOT.'lang/'.$pun_config['o_default_lang'].'/common.php';
if (!isset($lang_common)) exit('There is no valid language pack \''.$pun_config['o_default_lang'].'\' installed. Please reinstall a language of that name.');

// parse RSS

// make feed
/* original query
$result = $db->query(
    "select p.id as id, p.message as message, p.posted as postposted, t.subject as subject ".
    "from ".$db->prefix."posts as p, ".$db->prefix."topics as t ".
    "where p.topic_id=t.id ".
    "order by postposted desc ".
    "limit 0,15") 
    or error('Unable to fetch forum posts', __FILE__, __LINE__, $db->error());;

if (!empty($_GET["cid"])) {
    $where = "    AND c.id = '".intval($_GET['cid'])."'";
    $title = 'cid';
else if (!empty($_GET["fid"])) {
    $where = "    AND f.id = '".intval($_GET['fid'])."'";
    $title = 'fid';
else if (!empty($_GET["tid"])) {
    $where = "    AND t.id = '".intval($_GET['tid'])."'";
    $title = 'tid';
else {
    $where = '';
    $title = '';
$result = $db->query("
    SELECT p.id AS id, p.topic_id AS topic_id, p.message AS message, p.posted AS postposted, t.subject AS subject, f.forum_name, c.cat_name 
    FROM ".$db->prefix."posts p
    LEFT JOIN ".$db->prefix."topics t 
    ON p.topic_id=t.id 
    INNER JOIN ".$db->prefix."forums AS f 
    ON f.id=t.forum_id 
    LEFT JOIN ".$db->prefix."categories AS c 
    ON f.cat_id = c.id
    LEFT JOIN ".$db->prefix."forum_perms AS fp 
    ON (
        AND fp.group_id=3
    WHERE (
        fp.read_forum IS NULL 
        OR fp.read_forum=1
    ORDER BY postposted");
    $result = $db->query("SELECT * FROM rsstmp GROUP BY topic_id ORDER BY postposted DESC LIMIT 15
") or error('Unable to fetch forum posts', __FILE__, __LINE__, $db->error());;
$i = 0;
while ($cur = $db->fetch_assoc($result)) {
    if ($i == 0) {
        putHeader($cur, $title);

// get feed into $feed
$feed = ob_get_contents();

// create ETAG (hash of feed)
$eTag = '"'.md5($feed).'"';
header('Etag: '.$eTag);

// compare Etag to what we got
if ($eTag == $_SERVER['HTTP_IF_NONE_MATCH']) {    
    header("HTTP/1.0 304 Not Modified");
    header('Content-Length: 0');
} else {
    // dump feed
    header ("Content-type: text/xml");
    echo $feed;

/* entity to unicode decimal value */
function entity_to_decimal_value($string){
    static $entities_dec = false;
    if (!is_array($entities_dec)) {
        $entities_named       = array(" ","¡","¢","£","¤","¥","¦","§","¨","©","ª","«","¬","­","®","¯","°","±","²","³","´","µ","¶","·","¸","¹","º","»","¼","½","¾","¿","À","Á","Â","Ã","Ä","Å","Æ","Ç","È","É","Ê","Ë","Ì","Í","Î","Ï","Ð","Ñ","Ò","Ó","Ô","Õ","Ö","×","Ø","Ù","Ú","Û","Ü","Ý","Þ","ß","à","á","â","ã","ä","å","æ","ç","è","é","ê","ë","ì","í","î","ï","ð","ñ","ò","ó","ô","õ","ö","÷","ø","ù","ú","û","ü","ý","þ","ÿ","ƒ","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","•","…","?","?","?","?","?","?","?","™","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?",""","&","<",">","Œ","œ","Š","š","Ÿ","ˆ","˜","?","?","?","?","?","?","?","–","—","‘","’","‚","“","”","„","†","‡","‰","‹","›","€","&apos;");
        $entities_decimal     = array(" ","¡","¢","£","¤","¥","¦","§","¨","©","ª","«","¬","­","®","¯","°","±","²","³","´","µ","¶","·","¸","¹","º","»","¼","½","¾","¿","À","Á","Â","Ã","Ä","Å","Æ","Ç","È","É","Ê","Ë","Ì","Í","Î","Ï","Ð","Ñ","Ò","Ó","Ô","Õ","Ö","×","Ø","Ù","Ú","Û","Ü","Ý","Þ","ß","à","á","â","ã","ä","å","æ","ç","è","é","ê","ë","ì","í","î","ï","ð","ñ","ò","ó","ô","õ","ö","÷","ø","ù","ú","û","ü","ý","þ","ÿ","ƒ","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","•","…","?","?","?","?","?","?","?","™","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?",""","&","<",">","Œ","œ","Š","š","Ÿ","ˆ","˜","?","?","?","?","?","?","?","–","—","‘","’","‚","“","”","„","†","‡","‰","‹","›","€","'");
        if (function_exists('array_combine')) 
        else {
            foreach ($entities_named as $_entities_named) $entities_dec[$_entities_named]=$entities_decimal[$i++];
    return preg_replace( "/&[A-Za-z]+;/", " ", strtr($string,$entities_dec) );

function encode_xml($data){
    // line breaks
    // ending html tags into line breaks
    // remove other html tags
    // remove multiple newlines
    return entity_to_decimal_value($data);

function putHeader($cur, $title) { 
    switch ($title) {
        case "cid":
            $title = ' : '.$cur['cat_name'];
        case "fid":
            $title = ' : '.$cur['cat_name'].' : '.$cur['forum_name'];
        case "tid":
            $title = ' : '.$cur['cat_name'].' : '.$cur['forum_name'].' : '.$cur['subject'];
            $title = '';
    global $lang_common,$pun_config;
    echo '<'.'?xml version="1.0" encoding="'.$lang_common['lang_encoding'].'"?'.'>'."\n";
    echo "<rss version=\"2.0\" xmlns:content=\"http://purl.org/rss/1.0/modules/content/\">\n";
    echo "<channel>\n";
    echo "<title>".entity_to_decimal_value(htmlspecialchars($pun_config['o_board_title'].$title))."</title>\n";
    echo "<link>".$pun_config['o_base_url']."</link>\n";
    echo "<description>".entity_to_decimal_value(htmlspecialchars($rss_description.' '.$pun_config['o_board_title']))."</description>\n";
    echo "<language>en</language>\n";
    echo "<docs>http://backend.userland.com/rss</docs>\n";

function putPost($cur) {
    global $pun_config;
    echo "<item>\n";
    echo "<title>".entity_to_decimal_value(htmlspecialchars($cur['subject'].' in '.$cur['cat_name'].' : '.$cur['forum_name']))."</title>\n";
    $link = $pun_config['o_base_url'].'/viewtopic.php?pid='.strval($cur['id']).'#'.strval($cur['id']);
    echo "<link>".entity_to_decimal_value(htmlspecialchars($link))."</link>\n";
    echo '<guid isPermaLink="false">'.strval($cur['id']).'@'.$pun_config['o_base_url'].'</guid>'."\n";
    $data = parse_message($cur['message'],0);
    echo "<description>".encode_xml($data)."</description>\n";
        echo "<content:encoded><![CDATA[".$data."]]></content:encoded>\n";
    echo "<pubDate>".strval(date("r",$cur['postposted']))."</pubDate>\n";
    echo "</item>\n";

function putEnd() {
    echo "</channel>\n";
    echo "</rss>\n";

pogenwurst wrote:
NetworkShadow wrote:

That appears to be an un-modified version of the extern.php it doesn't do me any good. It half way does what I want, it just doesn't show post body content in the feed, it does however show only threads and not replies. If anyone knows how to mod it to do so I would be grateful.

Try this?

hcgtv wrote:

Get this rss.php file, look towards the end where mods were made by Daniel:


This one's great but it still shows the thread replies, and I don't want that.