Private community?

Started by MLLapan,

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MLLapanTopic starter

Is there a way to make all site go private and show login/register option for any visitor on any page, just when they login they see videos?
  •  

Rafael Q

Important!
The forums are not intended for support! There is Dedicated support available.
The troubleshooting can help a lot!
  •  

MLLapanTopic starter

Quote from: Rafael Q on
Hi,

Should be simple with a bit of code, here is a start https://www.phpvibe.com/how-to-use-the-phpvibe-user-system-premium-videos-example-included/
Thanks for the answer, but its too much of scripts included to get to know it, and apply this codes.
Can't you guys just give the code and where to put it to completely lock the site showing login and register box?
  •  

MLLapanTopic starter

This is the only feature I need actually.
So please if there is the way, help me out to acomplish this.  :)
  •  

Rafael Q

This depends strictly on how you want to do it.

if(!is_com('login') && !is_com('register')) {
/* Not on login or register page */
if(!is_user()) {
/* Guest browsing */
redirect('Some page?'); /* Redirect?Print something? Your call! */
}
}



Check also this https://www.phpvibe.com/targeting-componentspages-conditionally/
Important!
The forums are not intended for support! There is Dedicated support available.
The troubleshooting can help a lot!
  •  

MLLapanTopic starter

Quote from: Rafael Q on
This depends strictly on how you want to do it.

if(!is_com('login') && !is_com('register')) {
/* Not on login or register page */
if(!is_user()) {
/* Guest browsing */
redirect('Some page?'); /* Redirect?Print something? Your call! */
}
}



Check also this https://www.phpvibe.com/targeting-componentspages-conditionally/

Thanks you!
Isn't the !is_user() checks if the user is logged?
I want to do over all site, any link on site should show just login and register page/box until suer is logged in, when logged in person can see all.

if(!is_com('login') && !is_com('register')) {
/* You're guest so you can see only register or login form, and nothing else until you login. */
}
else if(!is_user()) {
/* You're user you can see home page, video pages and everything else */
}


Is it like this, and where to put this code to lock all the site for non-registered?
  •  

Rafael Q

'!" is a negation, you can read it as "is_user returns false".

You can drop it in index.php after the routing.
Important!
The forums are not intended for support! There is Dedicated support available.
The troubleshooting can help a lot!
  •  

Rafael Q

Quote from: MLLapan on
if(!is_com('login') && !is_com('register')) {
/* You're guest so you can see only register or login form, and nothing else until you login. */
}
else if(!is_user()) {
/* You're user you can see home page, video pages and everything else */
}


I think my code is easier and faster. You are complicating yourself.
Important!
The forums are not intended for support! There is Dedicated support available.
The troubleshooting can help a lot!
  •  

MLLapanTopic starter

Quote from: Rafael Q on
'!" is a negation, you can read it as "is_user returns false".

You can drop it in index.php after the routing.

You're a legend!  ;D Thank you!  :)
  •