• Welcome to PHPVIBE Forums. Please log in.

How to restrict visitors to login first to access the site

Started by HPR,

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

HPRTopic starter

Hello Mario and forum members
As i seen vibe have some new updates
i want vibe for my personal project
i have following requirement....

i want user to login first to surf the site,to watch the videos to comment etc.i mean for anything visitor must login first.
when someone clicked on link of vibe video they must go through login page .
No one should be able to see anything inside the website without logging in.
Also manual registration required

if this possible with vibe what changes this required?
anyone can help with this?
Thank you
  •  

Marius P.

Hi


if (!is_user()) {
//show something to guests
} else {
//show something else to users
}

You can use this in index.php and load a different component.

https://github.com/PHPVibe/PHPVibe/blob/master/index.php

for example replace :

$router->map('/', 'home', array('methods' => 'GET', 'filters' => array('id' => '(\d+)')));

with

if (!is_user()) {
$router->map('/', 'guesthome', array('methods' => 'GET', 'filters' => array('id' => '(\d+)')));
} else {
$router->map('/', 'home', array('methods' => 'GET', 'filters' => array('id' => '(\d+)')));
}

and then create your guesthome.route.php in /views

you can clone https://github.com/PHPVibe/PHPVibe/blob/master/views/home.route.php and change

include_once(TPL.'/home.php');

to

include_once(TPL.'/guesthome.php');

and you'll need to build that guesthome.php in the theme folder similar to how home is built, but with your custom content for guests https://github.com/PHPVibe/PHPVibe/blob/master/themes/main/home.php
Happy with my help? Buy me a coffee.
Please, always use the search before opening a new topic! We're all here on our (limited) free time! Make sure you help yourself too!
  •  

HPRTopic starter

Thanks Mario for explanation i ll check it asap ^-^
  •  

 

Similar topics (7)

[ Video Sharing CMS v4 ] how to create private channel with access for different user groups?

Started by fredericofrg


Replies: 1
Views: 5181

[ Video Sharing CMS v4 ] Can I use UltimaTube theme for phpvibe 4.0 ?

Started by longtt1986


Replies: 2
Views: 2644

[ Video Sharing CMS v4 ] Problem in /moderator/ login

Started by nobelkansal


Replies: 1
Views: 1471

PHPVibe - Example Sites

Started by fox_mulder


Replies: 1
Views: 1002

[ Video Sharing CMS v4 ] twitter login error

Started by hsynclb


Replies: 13
Views: 1787

Cannot open admin login page 404 error

Started by marbkao


Replies: 4
Views: 10954

[ Video Sharing CMS v4 ] Problem while login as Admin into Admin Dashboard

Started by mmahtabsaleem


Replies: 7
Views: 2421