05-12-2019, 12:45 AM
(05-11-2019, 04:13 PM)Carlo Wrote: Hi all!Hi Carlo. Your English is great. I'm on vacation so I don't have all my resources with me right now. Let me try to see if I can help.
First of all I am not a native English speaker so you might encounter some mistakes here and there.
I apologise in advance.
I don't even know if this is the right place to post my request for some help. My apologies if it's the wrong forum.
I managed to install US with ease. No major problems.
What I am looking for is, besides managing users (I can easily do that with the admin panels), to be able to have some basic tasks that, becoause of my very basic knowledge of PHP, I haven't been able to figure out properly.
When a user goes to a "protected" page I need the user to be presented with a login page if not logged in already, or continue reading the page if logged in.
After login, I need the user to get back to where it was stopped because the user had to login and continue.
Besides that, I would like to have user name on the top right side of each page he visits after login with the option to edit his profile and log out if desired.
Does any of you guys have some spare time to waste to provide me some detailed guidance for this?
I tried adding the suggested piece of code on top of the pages I wish to protect:
?>
require_once '../users/init.php';
require_once $abs_us_root.$us_url_root.'users/includes/template/prep.php';
if(isset($user) && $user->isLoggedIn()){
}
?>
What happens id that if I login as Admin I get the dashboard (which is fine) but if I login as User, I am redirected to the main page, while I would like the following:
If login ok, then continue visiting the page, if not redirected to another page of my choice.
I thank everybody in advance for any help you may provide.
Best and congrats for the great scripts provided to all.
Carlo
The easy one is the name in the upper right hand corned. If you go to the admin panel and settings->general settings, there is an option about the echouser function. If you set that to something other than username, that will be where the username is now and clicking that will take them to their account page. I think that's what you want. If not, let me know. That same settings page also has a place where you can choose where the user is redirected after a "normal" login.
The way the system works now is pretty much how I think you are wanting it to work.
1. If you just visit login.php, you are redirected to the "default" page the we set or you can specify a page in the settings.
2. If you were trying to visit a certain page and got redirected to login, you will go back there automatically.
You can test this by logging out and then trying to visit users/user_settings.php After you login, you will be taken back to that page.
Let me know if any of this does not work for you and I can give you more detailed instructions.
Dan