Yii 1.1: yii-forum

An easy to install, mostly self-contained forum module
35 followers

This module will add a forum to pretty much any site, with minimal efforts.

Requirements

Any Yii 1.1.* should work. (Developed with 1.1.12)

Usage

  • Extract file to application's protected/modules directory
  • Create database tables according to yii-forum/data/schema.mysql.sql
  • Optionally import sample data from yii-forum/data/sampledata.mysql.sql
  • Edit your configuration to register the module:
...
'modules'=>array(
    'forum'=>array(
        'class'=>'application.modules.yii-forum.YiiForumModule',
    ),
),
...
  • On user login, you will need to set a isAdmin state indicating if a user has administrator access. On an out-of-the-box Yii appliction, you could edit the components/UserIdentity.php file, and after successful authentication, add:
...
    $this->setState('isAdmin', ($this->name == 'admin'));
...

Now you should be able to browse to the forum at http://<your base url>/forum

Options

The following configuration options can be used:

userUrl: The url to generate for links to user profiles. i.e. 'Yii::app()->createUrl("customer/view", array("id"=>$id))' $id will be replaced with the site's user id.

forumTableClass, forumListviewClass, forumDetailClass: The CSS class applied to the Forum tables. When not set, Yii's default CGridView style will be applied. When set to "MyBB", an included style modeled after the the default MyBB theme will be used instead. When set to anything else, you will have to create our own styles.

dateFormatShort, dateFormatLong, timeFormatShort, timeFormatLong: Date and time format used to display date and time. See PHP's date function for more information.

dateReplaceWords: When set to true (default) today's date will be replaced with "Today", and yesterday's date will be replaced with "Yesterday"

threadsPerPage: The number of threads per page shown. Default is 20.

Embedded extensions

Versions

  • v0.1 (Oct. 10, 2012): Initial release
  • v0.2 (Oct. 11, 2012): Added userUrl option
  • v0.3 (Oct. 15, 2012): Added user page, added user signature
    • To update from previous versions, run this SQL command to add the new user fields:
ALTER TABLE forumuser
    ADD COLUMN signature TEXT NULL,
    ADD COLUMN firstseen INT(10) UNSIGNED NOT NULL,
    ADD COLUMN lastseen INT(10) UNSIGNED NOT NULL

Resources

Total 9 comments

#13602 report it
Hipogea at 2013/06/10 08:06pm
How do I get to work fine with Cruge Module?

I've installed the Forum Extension, but I work with CRUGE module for control acces instead user module. The problem is that every request appear a error:

Propertie "CrugeWebUser"."isAdmin" is undefined.

Any suggestion to fix the problem ???

#12740 report it
kokoseq at 2013/04/09 07:06am
Forum finally

Thanks! forum is what I really missed in extensions. I will try to use it soon:)

#10825 report it
Caliban at 2012/11/26 10:22am
Postgress

@Douglas: I have no experience whatsoever with Postgres, so as much as I would like to, I can not help you. It is obviously a difference in SQL dialect between MySQL and Postgres. However, in order for anyone to look into the problem, they're going to need more information. A tracelog would be most helpful I think. Either way, please move this to the forums.

#10787 report it
Douglas Lopez at 2012/11/23 11:56am
column «t.is_sticky» must appears in a GROUP BY clause in POSTGRES

Thanks for your forum module. I am trying to run this extension with Postgres 8.4.

I did the conversion.

However, I have the following error:

column «t.is_sticky» must appears in a GROUP BY clause.

I tried to fix it using pgadmin only, as follows:

SELECT forum_id AS c, COUNT(*) AS s FROM thread t WHERE (t.forum_id=2) GROUP BY forum_id, is_sticky, t.created, t.subject ORDER BY is_sticky DESC, created DESC, subject

And in pgadmin, it worked.

I did the module generation of the 4 tables you use, very careful (only copying the differences in rules and relations - just adding them, leaving yours).

May be the error is accepted in Mysql but not in Postgres.

Question:

In what part of your module can I include the rest of group by fields? All of the following fields: GROUP BY forum_id, is_sticky, t.created, t.subject

Maybe you have a better idea how to fix this error.

Please your help is needed.

Best Regards,

Douglas

#10260 report it
WebDevPT at 2012/10/15 11:47am
Nice updates :)

Keep up the good work :)

#10213 report it
grandoom at 2012/10/11 10:43am
Thanks

this is a very good job i'll test it shortly ;)

tested today = i love it

hope you shortly include the 'extrastuff.js' stuff!!

#10212 report it
Caliban at 2012/10/11 07:42am
Thanks

@WebDevPT: Thanks

@bettor: It has now:) Thanks for the suggestion.

#10211 report it
WebDevPT at 2012/10/11 06:48am
well done!

Keep up the good work!

#10205 report it
bettor at 2012/10/11 03:11am
Good start

Has a forum thread been raised to report issues and ideas?

Leave a comment

Please to leave your comment.

Create extension