• 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 ] Login Error !

Started by flliper


Replies: 6
Views: 1232

[ Video Sharing CMS v4 ] UltimaTube/Brasil Theme How To/Support

Started by PHPVibe A.


Replies: 176
Views: 27283

[ Video Sharing CMS v4 ] my Developer completed Video sitemap

Started by alimehdipak


Replies: 10
Views: 1362

[ Video Sharing CMS v4 ] POPUP LOGİN REGİSTER

Started by fireslayed


Replies: 1
Views: 1037

[ Video Sharing CMS v4 ] How to do Facebook and Gmail login integration,please help

Started by yasirm0hd


Replies: 3
Views: 1188

[ Video Sharing CMS v4 ] I cant login as moderator or as user

Started by CostelM


Replies: 5
Views: 2146

[ Video Sharing CMS v4 ] Google Login/Registration [google_config not found]

Started by surchin.co


Replies: 3
Views: 1518