PHP Fusion StudentID tracking
One of my projects is implementing a php-fusion CMS on a website that will be full of kids. The admins will be people working for the organization while the kids will just be users interacting with each other.
Now, we can't very well have weird pedophiles registering on the site, and we must know which student each account is tied too. Solution, each student physically walks up to a volunteer, hands them a form with their requested username and password, and within a few days (or hours) that student will be able to log on.
PHP-fusion allows users to change their email, password, and (shockingly) even their username. How would we ever know who is who? That's what this mod is for.
When the admin enters in the data for the student, they also enter in a unique ID for that student. This organization has a database of every kid who frequents the establishment, and all (good) databases will use a unique number for each student.
This number will not be visible to any students; as far as they are concerned it does not exist. This number cannot be changed (much like the incremental user_id). If you are an admin and look at the profile page, it will be visible.
With this in place, if a student posts something vulgar, or does anything inappropriate, the organization will know exactly who did what. Changing username will never matter as changing the username (in effect) affects every entry created by that user. So, all shouts and forum posts can be tracked back to the individual user.
First change is to the `users` table. Simply add an integer field called StudentID on the end:
ALTER TABLE `fusion_users` ADD `StudentID` INT NOT NULL ;
Secondly, you'll want to modify /profile.php. Find the text around line 100:
style='white-space:nowrap'>".$locale['u043']."
".number_format(dbcount("(post_id)", "posts",
"post_author='".$data['user_id']."'"))."
\n";
And change it into:
style='white-space:nowrap'>".$locale['u043']."
".number_format(dbcount("(post_id)", "posts",
"post_author='".$data['user_id']."'"))."
";
if (iADMIN) {
echo "
StudentID
".$data['StudentID']."
";
}
echo "\n";
Finally, you'll need to edit /administration/members.php. Around line 90, insert this row between the email row and the email visible row:
Rock StudentID
style='color:#ff0000'>***
class='textbox' style='width:200px;'>
Also in this file, around line 44, add this:
$StudentID = ereg_replace("[^0-9]", "", $_POST['StudentID']);While still in the same line, on about line 53, modify the long line that starts with $result so that it becomes this (all your doing is adding the StudentID parts):
$result = dbquery("INSERT INTO ".$db_prefix."users (user_name,
user_password, user_email, user_hide_email, user_location,
user_birthdate, user_aim, user_icq, user_msn, user_yahoo, user_web,
user_theme, user_offset, user_avatar, user_sig, user_posts, user_joined,
user_lastvisit, user_ip, user_rights, user_groups, user_level, user_status,
StudentID) VALUES ('$username', md5('$password1'), '$email',
'$hide_email', '', '0000-00-00', '', '', '', '', '', 'Default', '0', '', '', '0',
'".time()."', '0', '".USER_IP."', '', '', '101', '0', '$StudentID')"); After doing all this you should be set. If you have the site set up so users can't openly register but admins can add users this will work fine.
I was going to add this to the official php-fusion mods website, but there is too many guidelines involved with uploading the mod. If I was getting paid I'd take the time to do it :).


