The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
php script to add user to group
#5
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.

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.
  Reply


Messages In This Thread
php script to add user to group - by caleb - 06-19-2016, 05:07 PM
php script to add user to group - by mudmin - 06-19-2016, 05:13 PM
php script to add user to group - by caleb - 06-19-2016, 05:15 PM
php script to add user to group - by mudmin - 06-19-2016, 05:43 PM
php script to add user to group - by mudmin - 06-19-2016, 05:58 PM
php script to add user to group - by caleb - 06-19-2016, 06:04 PM
php script to add user to group - by caleb - 06-19-2016, 06:18 PM
php script to add user to group - by mudmin - 06-19-2016, 07:14 PM
php script to add user to group - by caleb - 08-27-2016, 05:39 PM
php script to add user to group - by mudmin - 08-28-2016, 12:19 AM

Forum Jump:


Users browsing this thread: 5 Guest(s)