Nice mod, but admins will need to be aware of the comment spam issues involved in opening up blog comments to the world.

I want to suggest a feature request, available to administrators, under Administration > Forums > Edit forum > Edit forum details, under 'Sort topics by' to allow forum topics to be sorted alphabetically

Presently 'Last post' or 'Topic start' are the only sort options available for topics - ie the sort order options are only chronological.

This is not very useful if you want to create a forum that is (for example) in the format of a noticeboard, where you want to list topics where chronology isn't important - eg such a topic list may be a student forum where the individual topics look like:

- Class lists
- New students
- Timetables

or an administration forum where the topics may be:

- FAQ
- Security: access control guidelines
- Security: using strong passwords
- What not to do on this forum

or a topic listing of bands under a 'Favorite Bands' forum:

- Beatles
- Klaus Wunderlich
- Nirvana

etc etc etc.

At the moment punBB can't do this for topics, and I think it would be generally very useful if it could.

I am encouraged that as a result of a previous feature request:
http://punbb.org/forums/viewtopic.php?pid=43318#p43318
Rickard amended punBB to allow alpha sort order for the Styles listed in the Profiles > Display drop-down in profile.php.

I think the option to alpha sort topics would be even more useful than sorting the list of styles alphabetically smile

Alpha sorting of topics has been raised as a modification before - http://punbb.org/forums/viewtopic.php?id=9049 - but it would be optimal if it were built into admin_forums.php as an option per forum out of the box, rather than as a hack.

In other words you have to pull the generated page into your page by calling it as a include from within your index.html home page.

You can do it as a php include from within the HTML of your page, as per the example Wai gave, or as a regular server-side include, viz:

<!--#include virtual="forums/news.html" -->

However, you have to tell Apache that it should scan your index.html page for include statements or PHP code.

By default, Apache won't go looking into .html files for includes of any sort, or PHP code to execute, for that matter.

Do this via a .htaccess statement such as this (for a html file):

# Enable Server-Side Includes
AddHandler server-parsed .html
Options FollowSymLinks Includes

However be aware that this may slow down your site as now Apache will try and scan every html page it loads for include statements.

It may be better for you to just try to run your index page as a SSI page straight up - ie index.shtml - which Apache should already know to scan for include statements.
Or just rename your index page as index.php, and then pull in your newsfile.htm using the syntax Wai describes.

354

(39 replies, posted in PunBB 1.2 troubleshooting)

Well, aside from ensuring that in Administration you have all those user display options on, from a quick look at the code it seems that line 111, which reads like this in a vanilla 1.2.15 punBB:

$last_post = '<a href="viewtopic.php?pid='.$cur_forum['last_post_id'].'#p'.$cur_forum['last_post_id'].'">'.format_time($cur_forum['last_post']).'</a> <span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_forum['last_poster']).'</span>';

looks like this in your code:

$last_post = '<a href="viewtopic.php?pid='.$l_pid.'#p'.$l_pid.'">'.format_time($l_post).'</a> <span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($l_pr).'</span>';

I think that may be the problem.  An expert like Smartys might like to confirm this.

Winmerge - http://winmerge.org - is your friend! I recommend it to you. It can make your life easier.

355

(39 replies, posted in PunBB 1.2 troubleshooting)

p0Wer wrote:

Hmmm...

What's bad if I just leave them?

As I said, your host might decide that you are a resource hog, and suspend your account. Since you seem to be hosted with GoDaddy, it has been known to happen.

Also all those queries mean extra work on the web server, extra work for PHP, extra work for MySQL, extra memory being used etc etc, which = delays in page loading and server responsiveness which = greater risk of crashes and also = slow site = annoyed users.

356

(39 replies, posted in PunBB 1.2 troubleshooting)

p0Wer wrote:

I don't have time I have coursework to do sad

Can't you just quickly just delete the queries throgh phpmyadmin?

LOL! A recipe for disaster smile

Upgrading the script should take you 30 minutes, at the most.

Just patiently re-do the instructions from the readme.txt in the latest version of the mod, being VERY careful to place things in the right locations etc.

I sure hope you aren't on shared hosting, BTW.

With that amount of queries running per page, multiplied by the number of visitors you say you are having and the page views they generate, then you are hammering MySQL and the server pretty hard.

Some shared hosts would be giving you a warning on your resource utilization with that amount of MySQL usage.

If really need the sub-forums mod, and you find you are stuck with using that many queries in using sub-forums, I'd seriously consider upgrading to a forum package that has sub-forum support built-in. phpBB or vBulletin or Invision, for example.

The latter two in particular can do the job much more efficiently than your current setup.

357

(39 replies, posted in PunBB 1.2 troubleshooting)

It looks to me like two queries generated by the sub-form mod have somehow run wild.

Most of your 156 queries are queries like

SELECT num_topics, num_posts, parent_forum_id, last_post_id, last_poster, last_post, forum_name FROM pspdowngradesforums WHERE id=55

These are identical to the query driven by the sub-form mod:

 $forums_info = $db->query('SELECT num_topics, num_posts, parent_forum_id, last_post_id, last_poster, last_post, forum_name FROM '.$db->prefix.'forums WHERE id='.$i) or error('Unable to fetch sub forum info',__FILE__,__LINE__,$db->error());

Ditto the query in your sub-forum mod code in index.php

 $subject = $db->query('SELECT subject FROM '.$db->prefix.'topics WHERE last_post_id='.$current['last_post_id']);

that generates the many

SELECT subject FROM pspdowngradestopics WHERE last_post_id=48989

queries.

Those two queries are responsible for about 148 of the 156 queries on your index.php. Something is clearly not working right with that mod smile

Go over to punres.org and check that you have the latest version of this mod, and that you have installed it correctly. Maybe even email or ask the mod author for advice.

Otherwise, un-install it sad

Then save and refresh and see what the query count is.

358

(39 replies, posted in PunBB 1.2 troubleshooting)

I guess this is you?

http://www.game-warp.com/forums/

I saw 156 queries on the home page when I was there... that's certainly a lot of queries. Normally one sees about 8 on a standard index.php.

359

(39 replies, posted in PunBB 1.2 troubleshooting)

If you go into /include/common.php, you will see the following at about line 30:

// This displays all executed queries in the page footer.
// DO NOT enable this in a production environment!
//define('PUN_SHOW_QUERIES', 1);

remove the // from the last line so that it reads: define('PUN_SHOW_QUERIES', 1); and save these changes to common.php, then go to your forum index page in your browser, hit refresh and post the output of the stuff down the bottom.

It should enumerate every query that gets run, and then you will have a precise idea of where all those queries were coming from.

After you've done this, put the // back in smile

And please, no multiple expensive SELECT * queries in links.php, like those at lines 218-225:

    $query = $db->query('SELECT
                          *
                        FROM 
                          `'.$db->prefix.'links_category`
                        WHERE
                          `column` = "'.$i.'"
                        ORDER BY 
                          `height`

and also similar SELECT * queries at lines 237-247, 271-276, etc.

These multiple SELECT * queries makes your app run slower, and violate 'MySQL rule #1: Select as little data as possible'.

Nice tips on optimizing MySQL: http://www.linuxformat.co.uk/wiki/index … QL_queries

I'm looking for a mod or some code to run every day and automagically close and delete posted topics after x number of days.

I want to add a classifieds section to a forum, and have ads deleted after 7 or 14 days, without doing so manually.

I know - I'm lazy and could just use the built-in 'Prune' function every day, or at the end of every fortnight etc...

Anyone know of any other mods that could do the job, or perhaps suggest how I could make the prune function cron-able to (for example) run every day, and save me the hassle of doing the chore manually?

punres turns up no pre-built mods or code, alas.

Ditch the old database if it is causing you problems. An easy fix.

Create a brand new MySQL database and then modify config.php to tell punBB about it. That should clear up the database errors at least smile  Then try running punBB again.

In terms of MySQL/PHPMyAdmin, you have to learn about user 'privileges' in MySQL.

What PHPMyAdmin is saying that you should setup a root user with a good password with 'privileges' to control all the databases you create. All users in MySQL need to have 'privileges' defined for what they can and can't do against specific databases. PHPMyAdmin is reminding you that unless you are careful in setting up MySQL's root account, anyone who can connect to MySQL on your device may easily take full control of your data. Not good.

If MySQL is only being accessed on a internal network, that may not worry you too much. But if it is publicly accessible, your device/webserver/MySQL needs to be secured, and securing MySQL is a big part of that. 

You will find a link to the 'privileges' area of PHPMyAdmin on the first page of PHPMyAdmin. Make sure you setup a root user who has full privileges and setup a strong password for them too.

how do I secure  my server?

That's a bigger issue.

If you aren't confident that you are able to put up a server where at least Apache is secure, PHP is secure, MySQL is secure and your file-system is secure, I really would suggest that you think again before putting any web server on a publicly accessible network. You will regret it if you don't.

OK, so you have done the basics:

- gotten MySQL and PHP and Apache (if applicable) working OK;
- created a empty MySQL database to hold your forum, and given it a name;
- created a MySQl user to own and operate that database too, if needed.
- then decided on the location for your punBB files in the folder system on your server (usually something like /home/username/mysitename/www/mypunbbforum

Then you've followed the punBB docs:

Installation
Copy/upload all contents of the directory upload/ into the directory where you want to run your forums. 
Run install.php from the forum root directory (e.g. open http://mydomain/myforums/install.php in your browser). Follow the instructions.

Then you have setup your "Database type", "Database server hostname" "Database name" "Table prefix" "Administrator username" "Administrator password 1" "Administrator's e-mail" "Base URL" as instructed by install.php.

And then you have created a new file called 'config.php' which you have placed in the root of the directory  you want to run punbb in  -eg /home/username/mysitename/www/mypunbbforum.

So you now have a website folder hierarchy that looks like this:

/www - the standard root of your Apache (or whatever) website,

and within that your punbb forum folders:

-/mypunbbforum - the root of your forum, with PHP files like register.php, viewforum.php and config.php there

and the following folders:

-/mypunbbforum/cache/
-/mypunbbforum/img/
-/mypunbbforum/include/
-/mypunbbforum/lang/
-/mypunbbforum/style/
   

That's all that is usually technically necessary to kick punBB into life. Do the basic config operations, then upload the files into the right place.

Please note that there is NO folder named 'upload' in the example above - that's just meant to be the name of the folder you upload your files FROM, into a folder like /www/mypunbbforum/ on your server.

If you have successfully done all the technical steps above, I suspect your problem may be as simple as having uploaded all your files in the wrong place. Maybe check that step again.

In particular, ditch the 'upload' folder and just unzip or move the main punBB files into your root punbb folder. In particular your config.php file. That's where punBB is looking for it.

What does a phpinfo say when run from the device?

Probably better to ask your question here too: http://www.synology.com/enu/forum/viewforum.php?f=20

Looks a cool device though. Nice webdev platform, potentially, as well as media sharer/backup etc.

365

(17 replies, posted in PunBB 1.2 show off)

Looks good. Wow. LOTS of customisation. You have my respect - very dedicated work.

All that modding is going to make any upgrades a nightmare though, you realise.  sad

Quick Q: what's the 'multi quote button'? Punres as usual shows up 120 pages of search results for the term, with nothing in them.

quaker wrote:

how about using punbb Multi-Forum Mod... example: http://mypunbb.net.forum1 forum2 forum3 etc. 1 db ...
Multi-Forum Mod
http://www.punres.org/files.php?pid=176

Q

Thanks. It looks VERY much what I want to do.

Alas the domain name (p8a.net) of the developer (Latheesan) has since lapsed and been taken over by domain squatters, so no demo site anymore sad 

And from looking at: http://www.punres.org/viewtopic.php?id=1093&p=2 it looks like all development of this stopped about 1 year ago.

Using it would also mean essentially reverting to a older and less secure version of punBB, unless I did a lot of page hacking/updating. 

And I don't like the idea of it requiring my forum root to be chmod to 777 and being world-writeable [!!!!]

But I'll certainly explore it.

BTW: I am quite surprised at the initial bad reception this guy got from the punBB/punres crowd. Quite bad vibes radiate out from some of the initial comments on his mod. Maybe all the grumpy, crusty old punBB'ers he encountered here and on punres encouraged him to leave and not come back

Good points Paul. I will ask some hard questions of vB and IPB.

It wouldn't be the end of the earth to change the scope of this project and setup individual puns, and doing so would have some pros as well as cons of course.

Bt I dread the idea of adminning too many boards at once. They may all be smallish, but it would be a ongoing, day-to-day hassle I would like to avoid. Hence my (wishful?) thinking re vB and IPB.

It would not be viable natch for vB and IPB (for $ reasons) after a point to install lotsa forums, so it would certainly be good if one install could service the requirement.

Thanks.

So (if I read you correctly) we would then have structure of ZZZforums.com like so:

ZZZForums.com Home

- Forum 1 (master, on  ZZZforum.com/forum1)
- Forum 2 (eg really on ZZZforum.com/forum2 and mapped via DNS <> forum.secondsite.com)
- Forum 3 (eg really on ZZZforum.com/forum3 and mapped via DNS <> forum.thirdsite.com)
etc

A DB (MasterpunDB) would then be created initially for Forum1, then Forum1 punBB installed on the server using MasterpunDB, then Forum2 installed, using a special prefix for its tables to allow it to share MasterpunDB, and ditto etc for Forum3, and so on.

Then Forum2 and Forum3 switched via phpMyAdmin to use the same user table, presumably.

And then mod each forum according to the look and feel requirements of the secondary site.

Hmmm. Still involves 3 punBB installs/codebases to manage + separate moderation per forum + separate anti-spam etc. And futzing with three site's templates. And cookies? And how would search work?

Messy.

Maybe more time/cost effective to just shell out the required $100 and get vBulletin or Invision for this project smile

Their approach seems much more scalable and ultimately easier to manage/implement.

For a project, I want to be able to run punBB under the following scenario:

I want to create several web sites for various small but related community groups. Each needs/wants a forum of their own. But I don't want to setup 3, 4 5 etc separate punBB's if I can avoid it smile

So how about this: punBB runs on a master site (eg ZZZforums.com). All forums on ZZZforums.com are browsable by anyone who comes to the master site, as normal. No problems there.

However, some forums on the master site would also be accessed as sub-domains of several secondary sites. Eg forum.secondsite.com would point to forum4 on ZZZforums.com, and forum.thirdsite.com would map to forum5 on ZZZforums.com. 

Pointing across as a full sub-domain is used so that when navigating within forum.secondsite.com it appears to users that they have a fully integrated forum of their own. I am hoping it is possible to map a subdomain to a typical punBB forum name like: viewforum.php?id=24 ...

This is mainly an administrative convenience for me: rather than setup 3 or 4 punBB's (one per site), I would like to leverage just one punBB install. Management, moderation, backups, stats etc would be much easier that way. Probably server load too. Users would also see a benefit from being able to access more content from a single sign-on too, if they wanted to go deeper into ZZZforum.com.

Those visitors who come to their specific forums on the master site via the sub-domains should see a specific site header and logo, so that when visiting their area of ZZZforums.com, their navigational experience remains consistent with the other areas of their 'home' secondsite.com.

The extent of the customisation might be as simple as swapping a logo around, since otherwise I plan to have the look-and-feel of ZZZforums and secondsite tightly consistent.

The ideal result would be that each of the nominated forums on ZZZforum.com would display to visitors from forum.secondsite.com or forum.thirdsite.com a custom header that matched their source site's look and feel.

However to users browsing ZZZforum.com from the index page of ZZZforum, forum4 or forum5 would retain the standard look and feel of the rest of ZZZforum.

If visitors from forum.secondsite.com want to browse to the root of ZZZforums.com though, it will be OK for them to then see the standard layout of ZZZforums.com.

Can punBB be persuaded to work this way?

In researching this, vBulletin for eg appears to be able to handle per forum customization by allowing the use of 'conditionals' so that you could use stuff like this in a vBulletin template:

<if condition="$foruminfo[forumid]">
 <div><img src="images/header_images/$foruminfo[forumid].gif" alt="$foruminfo[title]" border="0" vspace="2 px" hspace="0 px" align="left"/></div> 
</if>

Similarly, Invision seems to be able to allocate individual style elements per forum simply from within the Admin CP.

Are there options here with punBB? Perhaps involving PHP in some of the templates, or something clever with the pun variables?

I am stumped. Other posts in this forum or on Punres have little I could use. Maybe I was using the wrong search terms.

jkay, did you ever find a solution?

I'mkind-of interested in the same sort of thing. The simpler the solution the better. Ideally able to use the user details of punBB so that folks can have SSO with pun and the classifieds system.

Just the plain, un-linked name of the category is all I'm aiming for.

It would be nice if the category was indeed a link that took you to a page that displayed the forums within that category (vBulletin style), but I can live without that.

Smartys wrote:

You can't grab it from the quickjump for various reasons, the most important being that you have no way of knowing what category your specific forum is. Well, that and the fact that the quickjump is included AFTER you need to output the category name, so you don't have access to the query in the right place.

Thanks Smartys. I suspected so.

I may have to bite the bullet and modify an existing query or create a new one, and wear the 0.5% extra page performance and code maintenance overhead smile

Smartys wrote:

You would have to edit the query to add a join for the categories table

Aha. Thanks. I'd rather not add to the existing page query load, if I can avoid it. Unless that will add only a miniscule extra amount, and would be easy to do ...

Since footer.php pulls in the quickjump list (manufactured by includes/cache.php), and that information then gets included in both viewforum and viewtopic, directly or indirectly such a query is already effectively being run at least once (and sometimes twice in the case of index.php), on most punBB pages if they have the quickjump dropdown enabled.

So in the spirit of why buy new when used will do, I am thinking there must be a way to grab the category of the currently displayed page out of the existing quickjump drop down menu, without going back to the database, and display the current category a little bit higher in the page....? 

I am trying to do this to improve the navigational usability of a forum.

When you link to topics directly, or come into a viewtopic or viewforum via a search engine, and people don't come in via index.php, you get plonked directly into a topic or forum with no information anywhere on the page (or in the HEAD <title>) about the category it belongs to. Sometimes this information can be useful to visitors.

I mean it is certainly useful to see categories displayed in index.php, and it is useful to work with them in the Administration area smile, but this information isn't passed down to viewforum or viewtopic by default.

In one forum I am designing, one whole category is a post-only 'Noticeboard' space (items can be posted but not discussed), whereas the other major part of the site comprises 'forums' proper, where discussions on topics are allowed.  People need to quickly know which part of the space they have landed in.

That's the simple concept behind this.

Is there an easy way to add the current category identifier to the bread-crumb navigation in viewtopic.php and viewforum.php?

At the moment, for example, in viewforum.php at the top of the page you see:

'Index >> forum name'

and in viewtopic.php you see:

'Index >> Forum name >>Test post'.

I would like to see this line read, for example in the case of viewtopic.php:

'Index >> Category name >> Forum name >> Test post'.

The category name needn't form a link.

In looking at the code in index.php, where the category names are displayed, the category name is extracted as part of a complex query:

$result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.forum_desc, f.redirect_url, f.moderators, f.num_topics, f.num_posts, f.last_post, f.last_post_id, f.last_poster FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_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 ORDER BY c.disp_position, c.id, f.disp_position', true) or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());

which helps make the string

<?php echo pun_htmlspecialchars($cur_forum['cat_name']) ?>

which is used to display the category name in the HTML of index.php.

However viewforum.php and viewtopic.php don't run the same query and so the same code doesn't display any category name.

Is there an easy way to get this information to display on viewforum and viewtopic?

I mean it's there in index.php and also in the (cached) quickjump box that's already visible on both viewtopic and viewforum.

What I guess I want to avoid is adding another query into those pages to extract the current category name out. Is it floating around somewhere else?

As you can guess, I am not that confident in my PHP smile

Peter wrote:

Thanks Sirena! smile

JPcache looks easy to use. That's a great starting point. I'll try that when I have time and will report back...

No problems. I have successfully run jpcache for over 18 months on a site on a shared hosting account (PHP4) with no problems. It was indeed effective in speeding up a CMS I needed to use, since the web host didn't offer support for any other PHP cache. That site is now dis-continued, but if I needed to I would use jpcache again.

I haven't tried it with punBB though.