03-29-2019, 08:51 AM
(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.