View Full Version : Allow guests to View pages
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.
parayna
06-15-2017, 05:37 AM
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.
I think that it only applies to earlier versions :/
Hall of Famer
06-15-2017, 08:41 AM
To achieve this, you can add this line to your constructor method for the controller:
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:
$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!
Hall of Famer
06-23-2017, 03:38 PM
To make it available for guests, just change this part $this->access = "member" to $this->access = "guest".
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.