PDA

View Full Version : Another application using vBulletin registration and user modules. How do I do it?


alanpollenz
05-08-2005, 12:41 AM
I have a situation that I've not seen addressed elsewhere. Currently, my vBulletin application is open to all, but when a user registers, I validate him against a list of airline pilots from one specific airline and assign them to a custom usergroup. Once they are validated and assigned to this custom usergroup, they have access to the airline specific forums.

Now, I am writing severals applications in php/mysql that I would like to be accessible only by these previously validated members in this custom usergroup. As I see it, the easiest way to do this would be to hook into the vBulletin user database. There are several requirements for the system

If a user tries to log in to the new section, the vBulletin database is checked, and, if the username has been added to the custom usergroup, the user is granted access.
If the user goes to the new area, is in the custom usergroup, and a vBulletin cookie exists, the user is automatically logged in.
If the user logs into the new system, the vBulletin cookie is set, so that he is, in essence. also logged into the forums.
If the user registers, it adds him to the vBulletin database and I am sent the sign up email so I know that I need to validate him.
Any other vBulletin user signup and registration processes need to be incorporated.
So, what do I need to do to hook into the vBulleting registration system?

Thanks.

Alan Pollenz

Marco van Herwaarden
05-08-2005, 08:49 AM
Well the basics for integrating with vB are very simple, just include the following line in your script:
require_once('./global.php');
This will give you access to all the userinformation, including the groups a user belongs to. Just look into the $bbuserinfo array that will be set after you include global.php.

When your script is located outside the vB homedirectory, you will have to chdir to the forumhome dir before calling global.php, and depending on your script chdir back afterwards.

This should get you started. If you have any more specific questions, feel free to ask.

memobug
05-08-2005, 10:03 AM
You might also look at vbAdvanced cmps (http://www.vbadvanced.com) if you want to make your own custom pages, it could be an easy way to do it.

Regards,

Matt

alanpollenz
05-08-2005, 12:58 PM
Marco,

I think I can make due without actually hooking into the forum code at all. I can simply fork to the current registration process from the new application to register new users and use my current process to validate users for access.

What I will be doing is checking for the existance of the forum cookie for the "Remember me" feature as well as checking that the user actually exists in the database, the password entered matches the password in the database, and the usergroup access is appropriate.

The only problem I see is that the forum cookie for pdpbbuserid, as an example, has a host of forums.apapdp.org, and I'm not sure I'll be able to read this from within the members area, which will probably be members.apapdp.org.

Do you either:

Know a way, using PHP, to access cookies on one subdomain (forums.apapdp.org) from another (members.apapdp.org) or the top level domain (www.apapdp.org (http://www.apapdp.org/))?
Know what changes are required to make the forums output its cookies for sitewide use, such as Host: apapdp.org?
Thanks.

Alan Pollenz


Well the basics for integrating with vB are very simple, just include the following line in your script:
require_once('./global.php');
This will give you access to all the userinformation, including the groups a user belongs to. Just look into the $bbuserinfo array that will be set after you include global.php.

When your script is located outside the vB homedirectory, you will have to chdir to the forumhome dir before calling global.php, and depending on your script chdir back afterwards.

This should get you started. If you have any more specific questions, feel free to ask.

Marco van Herwaarden
05-08-2005, 01:30 PM
You can set the cooki domain in your vB settings. Note that this could be very troublesome to find the correct setting. Not a real cookie monster (ehh Expert) myself.

alanpollenz
05-08-2005, 02:49 PM
Thanks! That accomplished exactly what I wanted to accomplish.

You da man!!

Alan Pollenz