Trying if user not logged in rediret to "Home Page"

Ashwin Shahi Posted in Component Development 7 years ago

Hello All,

Am trying to redirect the user to home page if not logged in .
I user condition

if(!ossnisLoggedin()){
header("Location: ". "site
url/home");
}

in file C:xampphtdocsjsrewampp hemessocialossntheme.php
Its not working and breaking the theme as per css

Replies
pk Malik Umer Farooq Replied 7 years ago

Hellow bro! If you want to redict non login user to login page why you mention
if(!ossnisLoggedin()){
header("Location: ". "siteurl/home");
}
For this need
if(!ossnisLoggedin()){
header("Location: ". "siteurl/login");
}

in Ashwin Shahi Replied 7 years ago

so want would be the solution.
I want to redirect non-logged in user to login page

German Michael Zülsdorff Replied 7 years ago

Since site_url/home is a link reserved by Ossn for members who ARE logged in, and there's already a built in redirecting mechanism to move NOT logged in users away from home back to the starting page, your code is colliding with that logic.