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
#1
Hello you all.
User Spice looks like a great tool to implement Users Management.
My situation is:
I created a two page website (actually four pages since the site is bilingual).
The main file is in .html format with .js et .css files linked to it. This page is open to all visitors (no login, no cookies)
I like the design and functionalities and visitors like it to.

Now I want to restrict the view of the second pages to registered users that I will manage. On this second page there are links to .pdf files and videos.

My questions are:
Can I use UserSpice to manage self registered users?
Do I have to modify my html files (except add some php from UserSpice and change extension to .php)?
Same question formulated differently: Can I keep my .html file intact or will I have to recode my page?
In the admin section of the users management (UserSpice) can I add some custom fiels to the user's profile (example: years of experience or hobbies)?

Keep up the good work. Regards,

Alex DP
  Reply
#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
#3
Very informative reply.

Thanks a lot.

ADP
  Reply
#4
My pleasure. Let me know if there's anything else I can help with.
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)