Our site www.viart.com site is operated by latest Viart Shop 5 with default Clear design
Topic Information
Five5
Five5
Hi,
 
I am setting up a site that is to be used by a small group of registered user.
 
Has anyone some suggestions how I can:
 
Block access to everyone but the registered users of a special type.
 
I guess I need to have the system direct any unregistered access to a user login page.
 
Thoughts anyone....
 
freezer (Guest)
freezer (Guest)
I suppose it depends what is on the site
 
Did you know that every product, page or block can be restricted for viewing by user type.
 
Would this be sufficient?
 
Dave
 
Five5
Five5
Hi Dave,
 
Yeah I knew that but did not want to do it as changing every block has the potential to make a mistake and expose some restricted data to the general public.
 
Also, I thought through my requirement, and realised I need to restrict access to all but two user types. Not just one user type to get access. This is because the primary user type needs access, but also the admins need to review the site and their user type needs access without having to change their type about all the time.
 
I am still not sure how I am going to solve this one.
 
Five5
Five5
Anyone, anyone?
 
Ned
Ned
Could you use the multi-site capabillity and set up a sub-domain which contains the restricted content with a user and admin login?
 
Five5
Five5
Thanks Ned,
 
I have a public site, and as you suggest already set up a sub-domain site for private use.
 
What I am having trouble with is how to block a whole site (this sub-domain site). A good outcome would be if I could present all visitors to a login page, and once logged in, the sites works as normal.
 
So I wonder if anyone knows how to direct all unregistered users to a specific login screen?
 
I can't seem to find such a facility in ViArt. But maybe someone who knows more than I could prescribe something that might do the trick.
 
Ned
Ned
As its a sub-domain can't you just set the home page CMS to use "User Login" as the only block - or am I missing something?
 
Five5
Five5
But what if someone goes directly to another page not he home page, they would see the content no problem?
 
Ned
Ned
If you set up a "Site Users > Users Types" of "Registered" and restrict the page display to Registered users would that work?
Unregistered users see the login (and any other pages you allow on user type access).
Registered users see the restricted content.
 
 
Last modified: 27 Apr 2009 9:37 AM
 
ewoud (Guest)
ewoud (Guest)
as ned said:
As its a sub-domain can't you just set the home page CMS to use "User Login" as the only block - or am I missing something?
 
and
 
If you set up a "Site Users > Users Types" of "Registered" and restrict the page display to Registered users would that work?
Unregistered users see the login (and any other pages you allow on user type access).
Registered users see the restricted content.
 
should work perfectly
 
Five5
Five5
Hi ewoud. Where is 'page display' setting in 'user type' settings?
 
Obviously I set only the 'registered' user type to see the site, but non-registered users still see it.
 
I checked with ViArt Support and this is what they said:
 
"Yes it is possible to arrange by adding the login check option to the header. This way it will not allow unlogged users to browse the site and will be redirecting them on the login page.
 
For this open 'header.php' file and before this line:
 
include_once("./blocks/block_login.php");
 
insert the following lines:
 
if (!strlen(get_session("session_user_id"))){
if ($current_page != "user_profile.php" && $current_page != "user_login.php"){
header("Location: user_login.php");
}
}
 
Please remember to save a copy of the original file before doing any changes so you could restore it if something goes wrong."
 
This worked a treat. Any page of the site that is called directs to the user login page, then only those users and user types I specified now get access.
 
Thanks again to ViArt support to answered the support ticket within a few hours.
 
Thanks everyone else for their input as well.
 
xc (Guest)
xc (Guest)
plz explain it fully .....i hv the same probelm as i want that without login in users cannot access the futher pages directly by browsing the web page
address....
 
 
plz help...
its urgent....
thanks in advance.....
hope to see reply soon..
 
Five5
Five5
Hi xc.
 
I am in the middle of something right now but can replay again with more info in a bit. Although I am not sure I can explain it any other way than above.
 
If you can't wait, contact Viart for further assistance. I am sure (for a small fee) they can set it up for you on your site. In your support request link back to this page to bring them up to speed on your requirements.
 
Let me finish what I am up to and I will come back and see if I can explain better.
 
Five5
Five5
Hi xc, I'm back.
 
Let me try and rewrite the above instructions from Viart with a little more detail where possible.
 
On your server in the main application folder (on our server it is "public_html", on some it might be "www")
there is a file called "header.php".
 
Use an editor to edit this file. In this file there is a line
"include_once("./blocks/block_login.php");"
 
In my file it is line 14.
 
Just before this line, insert the following lines:
 
if (!strlen(get_session("session_user_id"))){
if ($current_page != "user_profile.php" && $current_page != "user_login.php"){
header("Location: user_login.php");
}
}
 
Save the file.
 
This should work. Any page of the site that is called directs to the user login page, then only those users and user types specified in Admin now get access.