06-19-2016, 05:58 PM
Ok. So when you're on the admin_permissions.php page and you click on a permission, you'll see that each permission level has an id. By default, User level is id 1, Administrator is id 2. As you add more, they go up. I'm guessing you want to add a third level. Take note of its id. (Let's assume it's 3).
So, the user will have to go to a particular page to trigger the "check" to add them to this permission group. Let's assume it's the default account.php. Somewhere at the top, you'll need to add a php check to see if they already have the proper permission.
This is totally off the top of my head, but should point you in the right direction. If you get stuck, let me know.
So, the user will have to go to a particular page to trigger the "check" to add them to this permission group. Let's assume it's the default account.php. Somewhere at the top, you'll need to add a php check to see if they already have the proper permission.
Code:
<?php
Code:
$check = $db->query("SELECT * from user_permission_matches WHERE user_id = $user->data()->id AND permission_id = 3");
Code:
$count = $check->count();
Code:
if($count<1) { //meaning that permission was not found for that user
Code:
$fields=array('user_id'=>$user->data()->id, 'permission_id'=>3); //column_name=>entry
Code:
$db->insert('user_permission_matches',$fields);
Code:
}
Code:
?>
This is totally off the top of my head, but should point you in the right direction. If you get stuck, let me know.