开发者

vBulletin database

Whats up.

I'm looking for some information about linking a vBulletin user database with my actual website's database. I do already have a users table, users have their main website profiles and all, but I would also like them to be able to use the same account on 开发者_运维技巧the forum (forum not up yet)

So is it fairly simple to do that? I'm simply asking because I have no clue, and don't know where to start!

Any help would be really appreciated!


unless you want to do some serious editing to the vbulletin code i suggest using vbulletin's user table for everything. if you did the main site yourself it should be alot easier for you to edit it then to edit vb.

just connect to the database like normal. then use mysql to check their username/password like so:

SELECT * FROM `usertable` WHERE `username` = '$username' AND `password` = MD5(CONCAT(MD5('$password'),salt)) LIMIT 1

if you need to include extra data for your main site be careful just adding rows to the user table as vbulletin doesnt like that. few ways around it

  1. make a vb plugin to the "userdata_start" hook with this code:

    $this->validfields['custom_usertable_row'] = array(TYPE_INT, REQ_YES);
    

    change TYPE_INT if your not saving an integer. and REQ_YES if the row can be null.

  2. add custom user profile fields. from the admincp User Profile Fields>Add User Profile Field

    it will add the field to a different table called userfield which you can get by joining the tables in a query

    SELECT user.username, userfield.field1 FROM user LEFT JOIN userfield ON user.userid=userfield.userid
    
  3. make your own table and join like above.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜