Allow guests to View pages

Forum
Last Post
Threads / Messages

Fox

Member
Member
Joined
Oct 4, 2016
Messages
34
Points
0
Location
Australia
Mysidian Dollar
3,819
I saw this same post for an earlier version of the script, but I have the latest version and I only want to make a handful of pages viewable by guests not logged in.
I tried to find a loggin section of code to edit but I'm lost as to how to make a few views.
 
I don't have the script up right this moment but I think on the view files, on pages guests can't view, there is a line of code that says if user is not logged in display "Guests can't view this page please log in". I know lots of pages have that code somewhere :) Sorry I couldn't be more help! I'm out at the moment so can't get an example up.
 
To achieve this, you can add this line to your constructor method for the controller:

Code:
 public function __construct(){       
    parent::__construct("member");         
    // The rest of constructor code if any      
}
This will mark the controller and its subsequent actions accessible only to logged in users, it is used in the account controller(http://yourdomain.com/account). If you want certain actions to be accessible by members only, you can add these lines to the action methods instead:

Code:
    $this->access = "member";        
    $this->handleAccess();
If you dont understand terms such as controller and actions, please let me know and I will explain further.
 
Thanks so much, I've had a play around and gotten the pages available to guests, cheers!
 
To make it available for guests, just change this part $this->access = "member" to $this->access = "guest".
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,267
Messages
33,048
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Latest Posts

Top