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
Newbie - Question
#2
Hey! Welcome to userspice.

1. Yes. If you want zero interaction on your part, require these additional pages to have the permission level of "user" in the admin pages panel in the administration dashboard.

2. Restricting access to pages is pretty simple. Rename the pages to php and put a require to the init file (your path might change depending on where your (formlerly) hmtl file is in your folder structure....

Code:
require_once 'users/init.php';
Then add this line...
Code:
<?php if (!securePage($_SERVER['PHP_SELF'])){die();} ?>

Note that your pages should be in the root folder (the one below the users folder) or the users folder. If you need it to be somewhere else, please edit the z_us_root.php file and add that folder to the array.

3. The rest of your html file can stay exactly as it is. Just make sure those two lines are there and that the file extension is changed.

4. So when you add those fields, you want to do it in a way that will not break if there is an update. The join.php file is one of the most complicated ones in userspice, so I would tend to want to put that info in user_settings.php. Whichever file you choose (or you can make a completely new survey), copy that file over to the usersc folder. (keep the file name the same). Edit the file in usersc to say

Code:
require_once '../users/init.php';
From that point on, userspice will load your "custom" user_settings.php instead of ours and you can modify to your heart's content.

If you want to get fancier, you could do it this way...
create a file in the root folder called additional_settings.php. Add additional fields to the users table in your database to store the extra info. Let's just say one is nickname. Make it required on your form. THEN, go into usersc/scripts/custom_login_script.

What you can do is put something like this

Code:
<?php
if(empty($user->data()->nickname){
Code:
Redirect::to('additional_settings.php');
Code:
}

What this will do is send them to the additional settings page ONLY if they haven't filled it out. Then after that, it will just log them in normally.

I also can't recommend this video enough (It's shorter than the time indicates) if you're going to be messing with the db.
https://www.youtube.com/watch?v=rb0kD5tCENM
  Reply


Messages In This Thread
Newbie - Question - by alexdp - 08-17-2017, 06:52 PM
Newbie - Question - by mudmin - 08-18-2017, 11:35 AM
Newbie - Question - by alexdp - 08-18-2017, 12:45 PM
Newbie - Question - by mudmin - 08-18-2017, 02:14 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)