This forum is archived. Posts are preserved for historical reference. For current help, join us on Discord.

Modify acccount.php

In New to UserSpice? · Started by dannyboy on 2016-06-15 5:48 am · 15795 views · 6 replies

I wanted to modify the account.php file and therefore moved it to the usersc folder. However when I login I get an error message. Is there something I am not doing correct or missing?

Thanks.
I think you have to re-point to the init file. I'm going to confirm with @Brian on this. He wrote that feature. I need to document it better.
Yes, but remember not to MOVE, but to copy the account.php. If you move it to the usersc/ folder, then your new path to the init should be ../users/init.php (i.e. move back one path level, then navigate to /users/init.php).
Ahhh. Great point!
Thanks for that. I did that and it works fine now. I also figured that out soon after posting the initial post. I did copy/paste the account.php file as opposed to move.

One other thing, in userspice version 3.x I would use the function if(!isUserLoggedIn()) { header("Location: ../my_signin.php"); die(); } to check if user is logged in if not redirect to my own signin page.

How can I do that in version 4.1?

Thanks


When a user is logged in, they're automatically assigned the variable $user. So in UserSpice 4, you can do...
if($user->isLoggedIn()){
//your code here
}
Thanks mudmin the function worked like a charm.