Skip to content

tommyalvarez/vbulletin_rails

 
 

Repository files navigation

VBulletin Build Status

Add single sign on to VBulletin forum in your Rails application

Installation

Add to your Gemfile and run the bundle command to install it.

gem "vbulletin_rails"

Requires Ruby 1.9.2 or later and Rails 3.0 or later.

Then patch your VBulletin.

~/vbulletin/upload $ patch -p0 < `ls -1d /path/to/gem/vbulletin-patches/* | tail -1`

Configuration

By default plugin assumes, that VBulletin database is the same as application, and without prefixes. In most cases this is unlikely to happen, so few database.yml extension are provided.

  • vbulletin_<environment> - with this section, you can provide database details if VBulletin database is located outside application database
  • prefix - VBulletin tables prefix - it has to be the same as in your VBulletin configuration

See database.yml example, for more details.

You may also need a COOKIE_SALT VBulletin constant if you want to handle permanent sessions. If yes, set this environment variable:

config.vbulletin.cookie_salt = '<COOKIE_SALT>'

Cookie salt is located in includes/functions.php in line 34 of your VBulletin package and is unique for every application.

Usage

Gem assumes, that you have User model which password and email or username fields. This will be removed in future version.

First of all add include_vbulletin to your User model:

class User < ActiveRecord::Base
  include_vbulletin
end

this will ensure, that vbulletin account will be created after registration, and VBulletin password will be changed simultaneously with User password.

If your User model uses other column names for email, password and username (which are default), then you have to inform gem about that, using set_column_names_for_vbulletin method. For example if you store emails in column user_email and passwords in user_pass, you need to add:

class User < ActiveRecord::Base
  set_column_names_for_vbulletin :email => :user_email, :password => :user_pass
end

User logging from VBulletin is handled out of box (which means, when user logs in into your VBulletin forum he will also log in into application). If you want to avoid this, use skip_before_filter :act_as_vbulletin.

To handle session vbulletin_login, vbulletin_logout, set_permanent_vbulletin_session_for and current_vbulletin_user are provided.

Development

Questions or problems? Please post them on the issue tracker. You can contribute changes by forking the project and submitting a pull request. You can ensure the tests passing by running bundle and rake.

This gem is created by Igor Rzegocki and is under the MIT License

About

rails vBulletin support

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 75.2%
  • JavaScript 15.7%
  • CSS 9.1%