Page 1 of 5

Forum module development

Posted: Tue Oct 03, 2006 3:07 pm
by tamlyn
EDIT: Latest version is available on the project page.

Still not had any reply from Piratos so I started on something. Attached is an alpha version that allows creation of forums in the admin and creating threads & replies in the front end. There is no authentication or error checking yet but it's taking shape. Note that I won't be providing automated upgrades during the alpha phase so you'll have to uninstall and reinstall whenever the database schema changes.

I need some help with the schema though. Looking at punbb, they store a lot of duplicate data such as the number of posts in the topic and the username of the last poster. This can (and has in my experience) lead to inconsistencies. Better would be to calculate that info from the posts table when required. But that requires more cpu time of course. What would y'all suggest?

We also need a mechanism for modules to add breadcrumbs to the {breadcrumbs} tag. I'll post in the dev forum about that.

Re: 'Forum' module abandoned?

Posted: Tue Oct 03, 2006 4:19 pm
by tamlyn
HashIT wrote: - why not use a date/time database field for posted/updated? This allows for UPDATE.. SET updated=NOW() kind of statements
Yes probably better. I'm more familiar with timestamps which is why i chose int. In fact although I know basic SQL i'm really no expert and know very little about optimising queries and stuff like that. I don't think the fact that we're using ADODB has much bearing on that apart from the inability to use db engine specific optimisations.
HashIT wrote: - don't we want to store who updated a post (moderators)?
yes probably.
HashIT wrote: - depending on wether we want to use BBcode or similar, I would save both the raw and the formatted version. This costs more space, but saves a lot of CPU cycles.
Right.
HashIT wrote: Can you PM piratos again and ask if you can get access to the forum project? That way you can add the code to SVN and use the other tools.
I submitted a request to be added to the project on cms forge. If I don't hear from him by the end of the week I'll ask Ted if he can add me. I'll hang out in the irc too and see if anyone knows where he is.

Re: Forum module development

Posted: Thu Oct 05, 2006 12:49 pm
by tamlyn
Attached Forum v0.2 to post #1. Added basic user auth using FrontEndUsers.

If guest posting is allowed then we need a way for guests to enter a name for themselves... so an extra field?

How should we do the user management stuff? What if the admin messes with the groups in FEU? We can pick it up using events but only after the change. What about user info like email addresses and stuff? We could just use FEU for logging in and registering and keep a separate table for all extra user info. But that seems messy. Hmm.

Also what's the best way of getting the last post time & user for each topic? Does it require one query per topic or is there a cleverer way to do it?

Re: Forum module development

Posted: Thu Oct 05, 2006 1:18 pm
by cyberman
tamlyn wrote: MODERATORS: please split this topic at reply #7
Done  :) ...
Forum v0.2 attached.
Thanks.
We could just use FEU for logging in and registering and keep a separate table for all extra user info.
Think it's a good idea to use FEU completely. So every forum admin is free to define all data fields he wants to know from his users.

Re: Forum module development

Posted: Thu Oct 05, 2006 1:44 pm
by tamlyn
cyberman wrote:
MODERATORS: please split this topic at reply #7
Done  :) ...
Oh that was quick! Thanks :)

I don't think there is a way to lock fields. If there was a OnPreEditGroup event we could use that to intercept any changes to groups that we are currently using and either block the changes or warn that it might screw everything up, are you sure?

While I agree that it's nice to let admins declare their own field set, certain fields will need to be treated specially (i.e. email, realname, avatar? etc.). Would it make sense to have the module create these fields/properties and the relevant groups on install (if they don't exist)?

Never quite got the hang of inner vs outer joins but I reckon an sql refresher will do me good - thanks for the pointers.

Re: Forum module development

Posted: Thu Oct 05, 2006 1:47 pm
by cyberman
HashIT wrote: Is there a way to lock certain fields, so that we can rely upon their existance?
Fields username and password are created by FEU.

Re: Forum module development

Posted: Thu Oct 05, 2006 1:55 pm
by cyberman
tamlyn wrote: While I agree that it's nice to let admins declare their own field set, certain fields will need to be treated specially (i.e. email, realname, avatar? etc.). Would it make sense to have the module create these fields/properties and the relevant groups on install (if they don't exist)?
It make sense  :).

Re: Forum module development

Posted: Tue Oct 10, 2006 7:51 pm
by tamlyn
HashIT wrote: Tamlyn, can you submit both versions as seperate revisions into SVN?
Done. And added you as developer. Feel free to start making changes or whatever. I didn't get enough paid work done last week so probably won't be able to do any work on this for a bit. I'll keep checking the forums though.

Re: Forum module development

Posted: Wed Nov 08, 2006 3:45 am
by tamlyn
HashIT wrote: For the former, you can construct a SQL query like this (read as psuedo code...):

Code: Select all

SELECT * FROM {joined tables},(SELECT forum_id, topic_id, MAX(post_id) FROM posts INNER JOIN topic ON (topic.topic_id = posts.topic_id) GROUP BY topic_id) ....

SELECT * FROM {joined tables},(SELECT topic_id, MAX(post_id) FROM posts GROUP BY topic_id) ....
....

Maybe this is a nice starter, if it ain't give me some time to get a dataset and work it out for you.
Yeah that's a nice starter but it seems MySQL pre 4.1 doesn't support nested queries. I think there are too many hosts still running 3.x and 4.0 to start using 4.1-only features. So I'll just use a whole bunch of separate queries for now and let someone else optimise it all later if they want/need to ;-) This module will probably be running pretty small forums in the most part so efficiency shouldn't be top of our list.

Re: Forum module development

Posted: Thu Nov 09, 2006 4:07 pm
by tamlyn
right, I'll kinda copy the punbb schema (below) then. It means you only need to query one table for each view (i.e. the forums table for the index view, the topics table for the forum view, the posts table for the topic view).

Forum:

Code: Select all

id  	
forum_name  	
forum_desc  	
redirect_url  	
moderators  	
num_topics  	
num_posts  	
last_post  	
last_post_id  	
last_poster  	
sort_by  	
disp_position  	
cat_id
Topic:

Code: Select all

id  	
poster  	
subject  	
posted  	
last_post  	
last_post_id  	
last_poster  	
num_views  	
num_replies  	
closed  	
sticky  	
moved_to  	
forum_id
Post:

Code: Select all

id  	
poster  	
poster_id  	
poster_ip  	
poster_email  	
message  	
hide_smilies  	
posted  	
edited  	
edited_by  	
topic_id

Re: Forum module development

Posted: Sat Nov 18, 2006 12:27 pm
by Alexx
Hello,

I have installed forum and works fine.
I had some problems finding stuff and what is where..
but now is ok.

When I finished whole forum, done some testing and I saw that there is no possibility for "mod" to change subject or delete post..
or any kind of changing.

So, is there an "upgrade" of forum in a near future..?

thanx

alex

Re: Forum module development

Posted: Sun Nov 19, 2006 12:57 pm
by tamlyn
This module is currently at the 'alpha' stage of development which means it is incomplete and only meant for testing. I'm very glad you were able to get it working (we must be doing something right!) but I'm afraid I haven't been able to do any more work on it recently. Keep an eye on the project page in the forge for future releases. Or if you would like to, dig into the code and add these features yourself. It would be appreciated by everyone :)

Re: Forum module development

Posted: Thu Nov 23, 2006 9:27 pm
by eeinarsson
Hi, good job so far on the Forum. Looking forward to future releases!

One question or problem to be exact.

Image

As you can see my icelandic letters dont print out correctly in the text, altough being right in the title. Letters like æ, þ, ð and é. Any idea what is causing this??

And is there a way for me to see what 'tags' ({$entry->name_link} for example) I can use?

Thanks
Elís

Re: Forum module development

Posted: Mon Nov 27, 2006 2:34 pm
by markr
I wrote a few patches to delete posts by a moderator, attached. Maybe useful for someone.

Mark

PS. I started with 0.3svn. To use them you might do something like "patch -b < fms-delete-post.patch" in the modules directory.

[gelöscht durch Administrator]

Re: Forum module development

Posted: Mon Nov 27, 2006 4:04 pm
by tamlyn
Nice one mark. I added a popup confirmation when clicking on delete links. It's in SVN now and I'm releasing v0.3.