• 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 ] Add Web Site Bookmark Icon to the Homescreen

Started by Luiggy


Replies: 3
Views: 849

[ Video Sharing CMS v4 ] modify new theme

Started by leen12


Replies: 10
Views: 1889

[ Video Sharing CMS v4 ] how to add register login in sidebar and player page

Started by tesladisk


Replies: 10
Views: 1148

[ Video Sharing CMS v4 ] Webmasters tools of Google reported 1 error in path: /sitemap.php?type=tags

Started by lucaphuoc


Replies: 4
Views: 2149

[ Video Sharing CMS v4 ] Can't access to administration

Started by shtefcs


Replies: 23
Views: 1662

[ Video Sharing CMS v4 ] What's happen my site not work good anymore ?

Started by haydenfan


Replies: 1
Views: 825

[ Video Sharing CMS v4 ] Home page blocks are not working as demo site

Started by Imran Murtaza


Replies: 2
Views: 1292