Building this forum was both easy, and hard. Of course. Here’s the deal:
Posting from the live site
This required making a form that can be placed on the site using a custom tag; allowing the administrator to choose what section the posted article should land in; and entering a few other bits of information (user name, posted, etc); then we are able to easily enter new articles into the “textpattern” table. I called my section “txphorum.”
When the article is actually a reply, there is an additional piece of information entered into the database — the id of the “parent”. I’ve got these being entered into custom field “custom_2” but this can easily be changed. In addition, replies need to be posted to a separate section. I called mine “txphorum_replies”.
Displaying posts and replies
On the Index, I use <txp:article form="txphorum_index" /> to display every article in section “txphorum” (the form gives it the table layout). When you click on an individual article, I use <txp:article form="txphorum_post" /> where the form gives it the layout, and includes the following at the bottom:
<txp:asy_wondertag>
<txp:article_custom post_or_reply="<txp:article_id />" form="txphorum_reply" sort="Posted asc" />
</txp:asy_wondertag>
That little trick is how you get the replies to show underneath the posts (with the form giving the replies their layout).
Security, login/logoff and self-register
For security, I’m relying on ign_password_protect. For registration, mem_self_register. Placing these on the page is easy; their built-in functions are very helpful and fit a forum well. With just these plugins you get basic perks of a forum (like displaying users online). Other plugins can be developed to fill out the available features of TXPhorum.
Miscellaneous
There are some custom tags required to build this. The first, obviously, is the “post_form.” It’s cousin the “edit_form” is next, plus a “edit_link_if_author” tag that, used in conjunction with ign_password_protect, only shows the “Edit” link if the user is the author, and if they are logged in.
That’s it. The rest is just elbow grease — making it look nice, arranging the pieces how you like, etc. I’m hoping that folks who build finished versions will share their PAGES, FORMS and STYLES with the rest of the community so that over time, people can simply plug and play.