Cupcake Forum v1.7
The Cupcake Forum is a CakePHP plugin based on the popular bulletin board system. Bundled with all basic features, simply drop into your application.
Recent Thoughts
- Twitter feed is currently unavailable. View my Twitter
Manual v1.x : Table of Contents
Cupcake v1.7 (Log)
Uploaded: 01/18/2010
Requires: PHP 5, CakePHP 1.2
Tested On: PHP 5.3, CakePHP 1.2.5
View Manual:
Cupcake Forum
Package: Plugin
Category: CakePHP
Views: 8,165
The Cupcake Forum is a slimmed down version of the popular bulletin board system, packaged into a plugin. The plugin can be dropped into any CakePHP application and will run smoothly with a bit of configuration. The plugin comes bundled with all the basic features of a stand-alone system, some of which include topics, posts, users, polls, moderators, staff and more. For a full list, view the chapter regarding Features.
Top
1 - Features
Below you can find a detailed list containing most of the features within the plugin. To better understand each feature, you should download and install the plugin!
Forums
Moderation
Administration
Security
Miscellaneous
Forums
- Forum wrappers and forum categories
- First tier sub-forums
- Activity and latest post tracking
- Auto-Lock old topics
- Enable/Disable post count increments
- Individual settings for reading, posting, replying, etc
- Access/Private specific forums
- Create topics or polls
- Reply to topics, or quote previous posts
Moderation
- Moderators, Super Moderators and Admin levels
- Restrict moderators to specific forums
- Inline moderation and management
- Mass processing (Move, Delete, Close, etc)
- Ability to edit and manage users content
Administration
- Full admin panel using CakePHP admin routes
- Requires the administration access level
- Can add, edit, order, delete forums and categories
- Manage all reported content
- Promote, demote, create access levels, staff and moderators
- Edit forum settings through the panel
- Manage all aspects and content
Security
- Utilizes CakePHPs Auth and Security Components
- Advanced flood protection (Posts and Topics)
- Hourly post limitations
- Registration security wall
- Form protection against bots and hackers
Miscellaneous
- BBCode support using the Decoda Helper
- Uses the GeSHi class for code syntax highlighting
- Utilizes remember me features
- Mark topics as read (Session)
- Log created topics and posts (Session)
- Access level verification
- Report system for topics, posts and users
- Search through topics (Title and Post)
- RSS feeds for each forum
Top
2 - Installation
Once you have downloaded the plugin, unzip and place the folder "forum" into your plugins directory. Once you have done that, your pathing should be: /app/plugins/forum/.
Setting up the URL routes
If you attempt to visit the plugin by going to the url yourdomain.com/forum, you will receive a missing controller error. Do not worry, this is correct because the actual path is /forum/home/index. Cake internally looks for a forum controller first because of its URL routing system. To fix this you would add the following route to your routes.php, which in turn will route the URL /forum correctly.
Setting up the RSS feeds
To make the RSS feeds work, you need to tell cake to allow the .rss extension. To do this, add the following code to your routes.php.
Installing the necessary database tables
For the forum to work, you will of course need to create the database tables. You may find the database schema within the /forum/config/schema/ folder. Once you have opened the schema.sql, simply open your database, copy and paste the schema, and finally execute the SQL statements.
However, if you have an already existent users table, you will need to run the SQL that alters the table (users_alter.sql), instead of creating a whole new table (users_create.sql). If you do not do this, the user sections of the forum will not work.
Furthermore, if you have an existent database with the same table names, there is a workaround. To explain it further, I will use the "topics" table as an example. If your current database has a table already called topics, you will need to add a prefix to your topics table. You can do it on a table by table basis, or you can add a prefix to all tables, it's your choice. Our next step would be to rename the forum topics table to forum_topics. Once you have renamed the table and created it in the database, the next step is to add the prefix within the Topics model (/forum/models/topic.php) by declaring the $tablePrefix property.
By using this approach, none of your existent tables will break or need to be changed, and the forum tables and models will still work flawlessly. If you don't want to rename a single table and prefix all your tables, you will need to change all the table names in the database, and then add the $tablePrefix to the ForumAppModel.
Creating your admin user
If you have an empty users table, either sign up on the forum or insert a user manually into the database, and then grab the user ID. If you have users already, simply grab the user ID for the user you want to give admin access (usually yourself). Once you have the user ID, open up the access table and execute the following statement (be sure to put in the user ID).
You now have admin access to the forum and may use the admin panel once you log in.
Setting up the URL routes
If you attempt to visit the plugin by going to the url yourdomain.com/forum, you will receive a missing controller error. Do not worry, this is correct because the actual path is /forum/home/index. Cake internally looks for a forum controller first because of its URL routing system. To fix this you would add the following route to your routes.php, which in turn will route the URL /forum correctly.
Router::connect('/forum', array('plugin' => 'forum', 'controller' => 'home', 'action' => 'index'));
Setting up the RSS feeds
To make the RSS feeds work, you need to tell cake to allow the .rss extension. To do this, add the following code to your routes.php.
Router::parseExtensions('rss');
Installing the necessary database tables
For the forum to work, you will of course need to create the database tables. You may find the database schema within the /forum/config/schema/ folder. Once you have opened the schema.sql, simply open your database, copy and paste the schema, and finally execute the SQL statements.
However, if you have an already existent users table, you will need to run the SQL that alters the table (users_alter.sql), instead of creating a whole new table (users_create.sql). If you do not do this, the user sections of the forum will not work.
Furthermore, if you have an existent database with the same table names, there is a workaround. To explain it further, I will use the "topics" table as an example. If your current database has a table already called topics, you will need to add a prefix to your topics table. You can do it on a table by table basis, or you can add a prefix to all tables, it's your choice. Our next step would be to rename the forum topics table to forum_topics. Once you have renamed the table and created it in the database, the next step is to add the prefix within the Topics model (/forum/models/topic.php) by declaring the $tablePrefix property.
class Topic extends ForumAppModel { var $tablePrefix = 'forum_'; }
By using this approach, none of your existent tables will break or need to be changed, and the forum tables and models will still work flawlessly. If you don't want to rename a single table and prefix all your tables, you will need to change all the table names in the database, and then add the $tablePrefix to the ForumAppModel.
Creating your admin user
If you have an empty users table, either sign up on the forum or insert a user manually into the database, and then grab the user ID. If you have users already, simply grab the user ID for the user you want to give admin access (usually yourself). Once you have the user ID, open up the access table and execute the following statement (be sure to put in the user ID).
INSERT INTO `access` (`id`, `access_level_id`, `user_id`, `created`) VALUES (null, 4, <ID>, NOW());
You now have admin access to the forum and may use the admin panel once you log in.
Top
3 - Configuration
In a fresh setup, the forum should work if you installed it correctly. However, there are times where you need to inject your own code, or to edit the theme, or to edit the settings. The following should help you in your endeavor.
Executing your own code specific to your application
The ForumAppcontroller will run your custom AppController's beforeFilter() and other callbacks automatically to inherit any settings and configuration you may have. If there is custom code that is not triggered in your applications beforeFilter(), you should place it in the method initForum() within the ForumAppcontroller. All code within initForum() will be called on each page request before any action is called.
Using your app's layout and not the forum layout
If you want to integrate the forum into your own application's layout, and not use the default forum layout, you would have to delete or rename the layout file. The layout file is located at /forum/views/layouts/default.ctp. If you do not use the forum layout, you will need to add the following code to your own layout.
However, your best bet is so keep the forum layout.ctp file, but replace the HTML with the original layout. By doing it this way, you want lose the RSS feed links, nor will you have to re-link the CSS and Javascript.
Customizing the forum theme
The administration panel does not come pre-built with a theme editor. You would need to edit the CSS stylesheet located at /forum/vendors/css/ or create your own from scratch. Additionally, you may edit the views to inject or remove HTML as you please.
Editing the forum title, limits, settings, etc
The forum comes pre-bundled with a list of settings that include flood intervals, page limits, site title, site email, security questions and many more. You will not need to edit these manually because the administration panel has a section devoted primarily to changing settings. Jump to the next chapter to learn more.
Executing your own code specific to your application
The ForumAppcontroller will run your custom AppController's beforeFilter() and other callbacks automatically to inherit any settings and configuration you may have. If there is custom code that is not triggered in your applications beforeFilter(), you should place it in the method initForum() within the ForumAppcontroller. All code within initForum() will be called on each page request before any action is called.
Using your app's layout and not the forum layout
If you want to integrate the forum into your own application's layout, and not use the default forum layout, you would have to delete or rename the layout file. The layout file is located at /forum/views/layouts/default.ctp. If you do not use the forum layout, you will need to add the following code to your own layout.
echo $html->css('/forum/css/style.css'); echo $javascript->link('/forum/js/script.js');
However, your best bet is so keep the forum layout.ctp file, but replace the HTML with the original layout. By doing it this way, you want lose the RSS feed links, nor will you have to re-link the CSS and Javascript.
Customizing the forum theme
The administration panel does not come pre-built with a theme editor. You would need to edit the CSS stylesheet located at /forum/vendors/css/ or create your own from scratch. Additionally, you may edit the views to inject or remove HTML as you please.
Editing the forum title, limits, settings, etc
The forum comes pre-bundled with a list of settings that include flood intervals, page limits, site title, site email, security questions and many more. You will not need to edit these manually because the administration panel has a section devoted primarily to changing settings. Jump to the next chapter to learn more.
Top
Read the whole documentation? Download the script now and try it yourself! Return to the Top
4 - Administration
Cupcake comes pre-built with a full blown administration panel that can edit nearly (the key word!) all aspects of the forum. It can add, edit, delete all the forums, users, topics, posts, reports, moderators, staff, so on and so forth. If for some reason you need to edit something that isn't in the panel, you will most likely need to do it manually in the database.
Additionally, the panel uses Cake's built in admin routing system, so you will need to turn admin routing on in your config if is has not been.
After you login, and after you have admin access with the logged in user, you will see an admin tab within the menu.
Changing the settings
Within the panel you will notice a "Settings" tab. From here you may change all settings related to the forum. Most of the settings -- besides the site related settings -- have been optimized to work best at those numbers, but you may change if you please.
Managing the forums
By default, Cupcake will create a forum and forum category. A forum cannot be posted in, it only acts as a wrapper for the forum categories. Forum categories is where all your discussions will be contained. While creating forums and categories, you may change the access levels for certain user restrictions, arrange the order, make it private and more. Furthermore, only first tier sub-forum categories are supported.
Promoting and demoting staff
Cupcake comes default with 5 access levels: Guest (being the lowest), Member, Moderator, Super Moderator and Administrator (Being highest of course). Moderators are able to edit specific forums, where as super moderators may edit all forums. Administrators will have full access to everything including the panel. You may create your own access levels -- for example Community Manager, or Staff writer -- but they must be based off one of the core access levels. So if the Community Manager has the same access level as Super Moderator, then it will be able to manage all forums.
Dealing with reported content
Users have the ability to report topics, posts and users if they find the content inappropriate, offensive, etc. Once reported, you can take the required or necessary action to delete, close, move, etc respectively. You also have the ability to discard the report but not edit the source content directly.
Additionally, the panel uses Cake's built in admin routing system, so you will need to turn admin routing on in your config if is has not been.
Configure::write('Routing.admin', 'admin');
After you login, and after you have admin access with the logged in user, you will see an admin tab within the menu.
Changing the settings
Within the panel you will notice a "Settings" tab. From here you may change all settings related to the forum. Most of the settings -- besides the site related settings -- have been optimized to work best at those numbers, but you may change if you please.
Managing the forums
By default, Cupcake will create a forum and forum category. A forum cannot be posted in, it only acts as a wrapper for the forum categories. Forum categories is where all your discussions will be contained. While creating forums and categories, you may change the access levels for certain user restrictions, arrange the order, make it private and more. Furthermore, only first tier sub-forum categories are supported.
Promoting and demoting staff
Cupcake comes default with 5 access levels: Guest (being the lowest), Member, Moderator, Super Moderator and Administrator (Being highest of course). Moderators are able to edit specific forums, where as super moderators may edit all forums. Administrators will have full access to everything including the panel. You may create your own access levels -- for example Community Manager, or Staff writer -- but they must be based off one of the core access levels. So if the Community Manager has the same access level as Super Moderator, then it will be able to manage all forums.
Dealing with reported content
Users have the ability to report topics, posts and users if they find the content inappropriate, offensive, etc. Once reported, you can take the required or necessary action to delete, close, move, etc respectively. You also have the ability to discard the report but not edit the source content directly.