Registered Users - Already Existing Site and Database (Features)

by Troy @, Wednesday, August 10, 2011, 14:37 (4614 days ago) @ IMC Magazine

Being an OpenSource project, I will gladly submit my 2 cents worth for free.
The way I accomplished this was simply add in my users to the mlf2_userdata table. All I needed was to add the username and user_type and password
Then, when my users logged into my site, I have SESSION['CFG'] class and set mlf2_user_id, and mlf2_user_type, then set the following:

$_SESSION['mlf2_user_id'] = $_SESSION['CFG']->mlf2_user_id; // 1 for moderator, 0 for regular user, 2 for admin;
$_SESSION['mlf2_user_name'] = $_SESSION['CFG']->username;
$_SESSION['mlf2_user_type'] = $_SESSION['CFG']->mlf2_user_type;

NOTE: mlf2 is the table prefix and $_SESSION['CFG'] is based off a class on my site. If you changed your table prefix, then change that accordingly.
Some data is not gathered doing the forum in this manner (such as Log In user's IP address, etc) but all that is being collected in other tables for my site.
The keys here are setting $_SESSION['mlf2_user_id'], $_SESSION['mlf2_user_name'], $_SESSION['mlf2_user_type']

Again, this works great for my site with a couple modifications to the tpl files to remove all My little forum login page references and to direct users to use my original site login.
When new users register on my site, I simply input the data into mlf2_userdata table at time of registration along with my original users table.


Complete thread:

 RSS Feed of thread