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
db query in during_user_creation
#1
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
  Reply
#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
#3
(03-29-2019, 08:51 AM)mudmin Wrote:
(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.

THANK YOU mudmin! It's working after i added "}" at the end of your statement Wink
Thank you for the fast and working response.
The reason why i edit the Core files is, that i can use my Bootstrap 4 design and use Userspice as the strong background.


And thank you again for Userspice, it's so nice to use and develop if you understand the base of Userspice.
Have a nice day.
  Reply
#4
Ahh. I didn't have my code editor with me. I figured I would miss something. One of a great things about the software that you can pretty much use it however you want. It is possible to use bootstrap for what's the templates, but you don't have to do it that way.
  Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)