The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (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
db query in during_user_creation
#2
(03-29-2019, 07:45 AM)LoveJailbreak4S Wrote: Hello,
at first, i love Userspice for so feature rich and easy understanding (after one week of reading and testing).
I changed the core _join.php file for my needs with a Dropdown to select with "typ" the new user is. My typs are "model", "videograph" and "fotograph".
now the chellange: i tried to edit the during_user_creation to do the following:
If the new user select the typ "model", give him automatically the permissionlevel "4" (4 is permissionlevel "model" i have created).
i tried an if-statement but i think this is really garbage (copied the ['typ'=>Input::get('typ')] code and match it with 'model')

Can you help me with this if-statement and db query?

Have a nice day

I'm glad you're enjoying UserSpice! Just one thing on the _join.php, there is a file in usersc/scripts called additional_join_form_fields.php to let you put that extra dropdown box in without risking having your code broken during an update.

So I'm guessing that your typ dropdown has a value of model in there somewhere, if so, it would look like this in during_user_creation.php
if(Input::get('typ') == 'model'){
$fields = array(
'user_id' =>$theNewId,
'permission_id'=>4,
);
$db->insert('user_permission_matches',$fields);

I'm pretty sure that's it. If it's not, let me know.
  Reply


Messages In This Thread
RE: db query in during_user_creation - by mudmin - 03-29-2019, 08:51 AM
RE: db query in during_user_creation - by mudmin - 03-29-2019, 12:31 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)