sfSimpleForumplugin - Bulletin Board / Forum for symfony
Overview
This plugin allows you to embed a forum within your symfony application with the following features:
- Topics are grouped into forums, forums are grouped into categories
- Topics are flat (= not threaded)
- Breadcrumb navigation
- Pagination
- Lists of latest messages are available for all forums, one forum, one user
- RSS feeds (requires sfFeed2Plugin)
- Identified users can participate in any topic and submit new messages
- User management is controlled through sfGuardPlugin
- Basic moderation (delete, stick or lok a topic)
- View count for topics and forums
- New messages since last visit shown as such
- Uses output escaping to prevent XSS attacks
- i18n ready
It is not aimed at replacing full-featured forum packages, but offers a lightweight alternative for when you build a website that has to contain a forum section. It is voluntarily simple, and contains many optimizations so that is remains fast even with a lot of messages and concurrent users. It is very easy to configure and adapt, so it should fulfill most basic forum requirements.
Please note that this plugin is in active development. If you want to help and improve it, please contact François Zaninotto.
Screenshots
Requirements
The prerequisites for using the sfSimpleForum plugin are:
- As the plugin doesn't contain a user management module, the project where you install it must have a table managing authors, or users (whatever the name), and the related Propel class must have a __toString() method. Both these conditions are satisfied by the sfGuardPlugin, so installing this plugin is a good choice.
- If you want to use RSS feeds, you must install the sfFeed2Plugin.
Installation
To install the plugin for a symfony project, the usual process is to use the symfony command line:
$ php symfony plugin-install http://plugins.symfony-project.com/sfSimpleForumPlugin
Alternatively, if you don't have PEAR installed, you can download the latest package attached to this plugin's wiki page and extract it under your project's plugins/ directory. You will also have to copy the contents of the myproject/plugins/sfSimpleForumPlugin/web/ directory into a myproject/web/sfSimpleForumPlugin/ directory.
Rebuild the model, generate the SQL code for the new tables and insert it into your database:
$ php symfony propel-build-all
Clear the cache to enable the autoloading to find the new classes:
$ php symfony cc
You can load the included fixtures to start using the forum with test data.
$ php symfony propel-load-data frontend plugins\sfSimpleForumPlugin\data\fixtures
Enable the new sfSimpleForum module in your application, via the settings.yml file.
// in myproject/apps/frontend/config/settings.yml
all:
.settings:
enabled_modules: [default, sfSimpleForum]
Start using the plugin by browsing to the frontend module's default page:
http://myproject/frontend_dev.php/sfSimpleForum
If you want to enable the plugin administration interface, you have to enable two more modules. You can do so in your main application or in a backend application. the following example is for a 'backend' application:
// in myproject/apps/backend/config/settings.yml
all:
.settings:
enabled_modules: [default, sfSimpleForumCategoryAdmin, sfSimpleForumForumAdmin]
Configure the plugin categories and forums by browsing to the administration modules default page:
http://myproject/backend_dev.php/sfSimpleForumCategoryAdmin http://myproject/backend_dev.php/sfSimpleForumForumAdmin
Slots
The templates of the sfSimpleForum module define some slots that you cna use inside your layout:
- auto_discovery_link_tag: For the auto discovery links, to be placed in the <head> section
- forum_navigation: For the forum breadcrumb and actions
An example layout for a standard display is given below.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<?php include_http_metas() ?>
<?php include_metas() ?>
<?php include_title() ?>
<?php include_slot('auto_discovery_link_tag') ?>
<link rel="shortcut icon" href="/favicon.ico" />
</head>
<body>
<div class="sfSimpleForum">
<?php include_slot('forum_navigation') ?>
</div>
<?php echo $sf_data->getRaw('sf_content') ?>
</body>
</html>
Configuration
Schema customization
If you install the sfPropelAlternativeSchemaPlugin, you can customize this plugin's schema by creating a sfSimpleForumPlugin_schema.custom.yml file under your project's config/ directory. This allows you to customize the connection name, table names, and even foreign class associations. Refer to the README file for more information.
You can choose to use another user management system than sfGuard. In that case, you need to change the foreign key associations for every user_id column with a custom schema. You also need to change the user_class parameter in your app.yml (see below).
app.yml
Some of the features of the plugin can be altered by configuration. To do so, add some of the following lines to your application's app.yml:
all:
sfSimpleForumPlugin:
forum_name: My symfony forum
display_categories: true
use_feeds: true # requires sfFeed2Plugin
count_views: true # count each time a topic is viewed. Turn off to increase performance
max_per_block: 10 # maximum number of links displayed in a block
include_breadcrumb: true # include breadcrumb slot content. Turn off if you don't use the breadcrumb.
breadcrumb_separator: ' » ' # separator for breadcrumb trail
max_per_page: 10 # maximum threads or messages per page
pages_displayed: 5 # maximum pages displayed by the pager navigation
feed_max: 10 # maximum messages served by feed
show_author_details: false # display number of messages of post authors
allow_new_topic_outside_forum: true
user_class: sfGuardUser # name of the class used to manage users
retrieve_by_name_method: retrieveByUsername # name of the static method used to retrieve a user by its username
Routing rules
The plugin doesn't come with any routing rule. However, you can add some of your own to make the URLs look nicer. An example of set of rules could be as follows:
forum_home:
url: /forum
param: { module: sfSimpleForum, action: forumList }
forum_latest_messages:
url: /forum/latest/:page
param: { module: sfSimpleForum, action: latestPosts, page: 1 }
requirements: { page: \d+ }
forum_latest_messages_feed:
url: /forum/latest/feed
param: { module: sfSimpleForum, action: latestPostsFeed }
forum_forum:
url: /forum/:forum_name/:page
param: { module: sfSimpleForum, action: forum, page: 1 }
requirements: { page: \d+ }
forum_latest_messages_for_forum:
url: /forum/:forum_name/latest/:page
param: { module: sfSimpleForum, action: latestForumPosts, page: 1 }
requirements: { page: \d+ }
forum_latest_messages_for_forum_feed:
url: /forum/:forum_name/latest/feed
param: { module: sfSimpleForum, action: latestForumPostsFeed }
forum_topic:
url: /forum/topic/:id/:stripped_title/:page
param: { module: sfSimpleForum, action: topic, page: 1 }
requirements: { page: \d+ }
forum_topic_feed:
url: /forum/topic/:id/:stripped_title/feed
param: { module: sfSimpleForum, action: topicFeed }
forum_new_topic:
url: /forum/new_topic/:forum_name
param: { module: sfSimpleForum, action: createTopic }
forum_latest_messages_by_user:
url: /forum/user/:username/:page
param: { module: sfSimpleForum, action: latestUserPosts, page: 1 }
requirements: { page: \d+ }
forum_latest_messages_by_user_feed:
url: /forum/user/:username/rss
param: { module: sfSimpleForum, action: latestUserPostsFeed }
forum_post:
url: /forum_message/:id
param: { module: sfSimpleForum, action: post }
Look and Feel
The sfSimpleForum module comes with a default stylesheet. You can choose to use your own stylesheet instead of the default one. To do so, you must create an empty sfSimpleForum module inside your application with just one config/view.yml file in it, with the followin content:
all: stylesheets: [-/sfSimpleForumPlugin/css/default.css, myCustomStylesheet]
I18N
You can write own translations for this plugin by providing an sfSimpleForum.XX.xml file, whereas xx is the locale. If you are upgrading from version 0.6.5 or earlier and created a messages.xx.xml file for your translation, you need to rename it.
TODO
- Authors can edit a message during its first minutes
- Moderators can edit a message
- Moderators can move a topic to another forum and a message to another topic
- Add images to make the default style less ugly
- Subscribe to a topic by email
Active tickets
- #2655
- implement an inline whisper system
- #3149
- bad name for retrieve_by_name_method in lib/sfSimpleForumTools.class.php
- #3156
- sfSimpleForum does not preserve line breaks
Changelog
2008-03-13 | Trunk
- francois: Changed counts types to integer
2008-02-28 | 0.6.6 Beta
- francois: Fixed broken link to feed (#2599)
- francois: Packaged with other plugins into an application (cf. http://www.motilee.com)
- Pascal.Borreli : Fixed incorrect use of a block element inside a inline element (#2628)
- nicolas: Slightly refactored pagination helper
- nicolas: Removed dependency on sfGuardUser
2007-11-08 | 0.6.5 Beta
- francois: Added two modules for backend administration
- francois: Removed schema configuration file (use sfPropelAlternativeSchemaPlugin if you must customize the schema)
- francois: Added a supplementary customization layer to the model classes
2007-10-10 | 0.6.4 Beta
- francois: Fixed missing files in package definition (#2336)
- francois: Fixed empty forums do not appear in the forum list (#2330)
- francois: Added a new partial to allow third-party profile enhancements
- francois: Further optimized queries
2007-10-03 | 0.6.3 Beta
- francois: Extended the cache coverage
- francois: Partialized templates for easier customization
- francois: Refactored Forum and Topic counts (now working with save and delete)
- francois: Made the schema customizable
- francois: Added link to last page for multi-pages topics
- francois: Refactored actions class for easier custom templating
- francois: Fixed topic feed
- francois: Added a topic list (for all forums, for one user) and related feeds
2007-09-25 | 0.6.2 Beta
- francois: Improved security and credentials handling
- francois: [Break BC] Added a new topic table
- francois: [Break BC] Refactored most of the code to be more extensible, performant and readable
- francois: Added "New message to read" indicator in topics (distinct from topic views, because anonymous users must still increase the topic views)
- francois: Better handling of post titles
- francois: Refactored the way a forum knows about its last post
- francois: Simplified the interface (removed buttons, lessened clicks)
- francois: Added latest posts component
- francois: Fixed page displayed after adding a message doesn't use pagination
- francois: Added a new getMessage() action
- francois: Switched icon set to famfamfam as I couldn't find where the sticky one came from
- francois: Added locked topic feature
- francois: Added unit tests for forum and topic calculated fields
- francois: Fixed forum and topic calculated fields
2007-09-07 | 0.6.1 Beta
- francois: Optimized calculated fields in model
- beleneglorion: Added sticky topic feature
- francois: Added View count on topics
- francois: Renamed sfBBPlugin to sfSimpleForumPlugin
- francois: Fixed output escaping
- superhaggis: Fixed typo in schema.yml
0.6.0 Alpha
- francois: Major refactoring (breaks BC) but now the plugin is functional
- francois: Removed the unimplemented parts
0.0.4 (not released))
* [3678] by superhaggis
- Updated CHANGELOG.
- Added new file entries to package.xml.
* [3958] by superhaggis
- Swapped more tables for divs.
- Added CSS class for table.
- Renamed extendable action class and moved logic into correct class.
- Modified occurances of changed class name.
* [3959] by superhaggis
- Refactored CSS path computation.
* [3983] by superhaggis
- Fixed autoload issue; see #1245.
* [3984] by superhaggis
- Updated CHANGELOG; added TRUNK section and included dev name beside each list item.
- Tweaked package.xml slightly to include CHANGELOG and renamed action lib.
* [3985] by superhaggis
- Added category check; error message is presented if no live categories found.
- Added initial docblocks.
* [4006] by superhaggis
- Added initial viewThread and viewPost logic.
* [4014] by superhaggis
- Added additional CSS classes for viewForum.
* [4015] by superhaggis
- Added method to retrieve a thread's replies.
- Created initial HTML template for viewThread.
* [4016] by superhaggis
- Added shortcut method to access post's creator.
- Refactored getReplies() to implement shortcut.
- Replaced method calls in viewThread template.
* [4020] by superhaggis
- Reformatted and updated CHANGELOG.
0.0.3
* [3677] by superhaggis
- Changed sfBB_lastpost() to use format_datetime().
- Added additional sf_guard_user_profile fixture.
- Dropped divs in favour of tables for the time being.
- Rewrote default.css to accomodate new tabled layout.
- Added getter methods to sfBBPost and sfBBForum model classes.
- Added stripped_title column to sf_bb_post table.
- Added additional rule for @sf_bb_viewforum route.
- Created initial viewForumSuccess template.
- Created basic executeViewForum action.
0.0.2
* [3668] by superhaggis
- Added CHANGELOG.
- Added sfGuardPlugin dependancy to package.xml.
* [3670] by superhaggis
- Removed broken PEAR dependency.
- Added prepended routing rules to plugin config.
* [3671] by superhaggis
- Updated CHANGELOG.
- Updated package.xml.
- Edited routing section in README.
* [3672] by superhaggis
- Removed TO-DO section from README.
- Fixed incorrect pathing in package.xml.
0.0.1
* [3667] by superhaggis
- Initial public release/check-in.
Attachments
- sfSimpleForumPlugin-0.6.0.tgz (18.0 kB) - added by francois on 07/03/07 14:18:17.
- sfSimpleForumPlugin-0.6.1.tgz (19.6 kB) - added by francois on 09/07/07 16:55:47.
- sfSimpleForumPlugin-0.6.2.tgz (23.9 kB) - added by francois on 09/25/07 16:56:10.
- sfSimpleForumPlugin-0.6.3.tgz (25.8 kB) - added by francois on 10/03/07 23:22:12.
- sfSimpleForum_1.gif (21.0 kB) - added by francois on 10/08/07 18:31:46.
- sfSimpleForum_2.gif (15.1 kB) - added by francois on 10/08/07 18:32:25.
- sfSimpleForum_3.gif (14.3 kB) - added by francois on 10/08/07 19:45:34.
- sfSimpleForumPlugin-0.6.4.tgz (27.1 kB) - added by francois on 10/10/07 15:54:40.
- sfSimpleForumPlugin-0.6.5.tgz (27.6 kB) - added by francois on 11/08/07 14:21:12.
- sfSimpleForumPlugin-0.6.6.tgz (29.5 kB) - added by francois on 02/28/08 09:02:18.


