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
Redirect After Login based on Username
#5
Ok. So let me make sure I understand. So let's say your project is at https://example.com.

If you want to direct the user named steven to a folder that is at https://example.com/steven

Then you would probably want to first make sure that everything is lowercase, so maybe you would do...
$url = strtolower($user->data()->username);

Note that if you go into the database, then username is the COLUMN in the database in the users table. That's where the information is coming from.

So to redirect to https://example.com/steven if steven is the username then you would do
Redirect::to($us_url_root.$url);

This is because $us_url_root already has the / at the end.
if you want to do something beyond that, like calendar you can definitely just add something to the end of the url.

So one more thing. This requires you to create a custom folder for every single user. Normally with php, people will have one calendar.php file and just load the information of the logged in user. Is there any particular reason of why you want to do it this way?
  Reply


Messages In This Thread
RE: Redirect After Login based on Username - by mudmin - 04-25-2019, 06:35 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)