http://www.yiiframework.com/extension/sforum/
sql dump is in the module root folder, you could ofcourse use another type of database if you like,just create the necessary tables as shown in that file.
Attached is:
sforum.zip , the module itself
forum.zip , a demo app
Features:
Topics:
Add attachments by drag&drop or multi file upload thanks to XUpload extension
Image attachments (with the extensions you approve) is shown in lightbox style(using easybox)
A bbcode editor with preview functionality
Edit the topic, or title easily thrue ajax
Browse topics in a category and its latest threads etc
An ajax search function that searches in both title and content of all topics to get the results.
Neat slide-to-unlock(iphone/android style) captcha
Moderator functionality:
Move topic to a diffrent category (including trashbin category)
Delete topic
Make the topic sticky, or remove the sticky status
Comments:
Comment with the bbcode editor
Quote comment
Edit comment
Upvote/downvote comment
Moderator functionality:
Delete comment
Categories:
Browse topic per category
See latest treads and by who
Quick browse between the other categories while viewing one.
Moderator functionality:
Create, delete or rename categories in the admin panel
Decide the order in which the categories will be shown thrue a drag&drop sortable list in the admin panel
Other admin functionality:
View stats (currently only number of threads,comments and users) in a nice user friendly graph.
View trashbin, threads that instead of beeing deleted has been sent to the trashbin category so another moderator later on can study it and decide to delete it entirely or "approve" it, sending it back to a normal category that visitors and normal users can see.
To install:
Put the sforum folder in your protected/modules folder
in your config file make sure you have these things set:
'aliases' => array(
'xupload' => 'application.modules.sforum.components.xupload', //used for the attachment uploads
),
'modules'=>array(
....
'sforum'=>array(
'newTopicStatus'=>'visible', // or hidden. Description: What status should newly created topics get.
'userClass'=>'User', //set the name of your user model
'commentsPerPage'=>3, //number of comments per page
'uploadDir'=>'/uploads/',// where to upload attachments
'userUrl'=> "/user/view/id/{{userid}}", //the url to the user profiles in your project
'imageExt'=>"jpg,gif,png,jpeg",// what extensions for attachments should be treated as images and shown in a easybox window if clicked
),
.....
FAQ:
Question: What is the userUrl options and how do I modify it?
Answer: You should set the userUrl to the url that your app uses to show a users profile. In that url you should use {{userid}} at the place in the url where you use the userid. Sforum will automaticly swap this with the userid that has created a topic or comment.
Not good enough? Well just customize the userUrl method in SForumModule.php
Question: Why this instead of myBB or other feature rich forums?
Answer: This module was written to provide a basic forum experience that can easily be integrated in any yii project.
If you want an ultimate forum solution for big communities this wont suit you, since I’m a single developer doing this as a hobby and do not have the possibility to create a forum with ALL features. But many sites only needs something simple, and this module can easily be used with any user system.
This is also my attempt to make a forum as user friendly as possible using ajax more then the big forum solutions I’ve seen.
Question: How do I controll which ones are moderators? and who is allowed to comment or create topics?
Answer: Please look at SForumModule.php and look at these methods:
//moderator/admin method
//if this method returns true then the user will be able to delete comments,topics and move topics
//you can change the logic of the method if you want
public static function moderator()
{
if(!Yii::app()->user->isGuest)
{
return true;
}else{
return false;
}
}
//comment method
//if this method returns true then the user will be able to comment and reply to comments
//you can change the logic of the method if you want
public static function allowComment()
{
if(!Yii::app()->user->isGuest)
{
return true;
}else{
return false;
}
}
//topic method
//if this method returns true then the user will be able to create new topics
//you can change the logic of the method if you want
public static function allowTopic()
{
if(!Yii::app()->user->isGuest)
{
return true;
}else{
return false;
}
}
With this you can customize exactly who will be able to moderate the forum and who is allowed to comment. Currently this module does not support not logged in users to comment, since a userid will be needed for each comment and topic.
Question: Do I have to use bootstrap?
Answer: No, I have on purpose not used the bootstrap extension or any bootstrap javascript. Bootstrap is only used and included for the css.
You can remove this and modify the views to use any css you want. None of the functionality depends on bootstrap.
Question: Why is there javascript code in the views?
Answer: I’ve done the most I possibly can to move all jQuery code to the external sforum.js file. But some code has to be in the view to work properly.
If you find a way to decrease the amount of javascript code in the views, please provide your solutions and I will update this module.
Question: Why have you mixed CHTml::tag and html?
Answer: Originally I did all html code the old school way. But then I regretted that choice and started to convert as much as possible to CHtml code.
I’m alittle bit lazy and have not finished all of this yet, feel free to help and contribute your changes.