Jump to content
TNG Community
Sign in to follow this  
Roelj

How to hide user pages?

Recommended Posts

Roelj

On my site (https://roeljongman.nl) login is not required, but i hide details using the Public Access Control-mod.

I have also created some user pages using the historytemplate.php. 

Is there a way to hide these pages also for public access?

Share this post


Link to post
Share on other sites
tngrlkrz

Take a look at restrict access mod and how it works or you can maybe add similar code to the history template php files,  perhaps.

You basically check for $currentuser, to allow or disallow. 

Ron 

Share this post


Link to post
Share on other sites
Newfloridian

I think this will depend on your reasoning for the use of your individual historytemplate.php pages. I have a large "user added" magazine built on to my site with now nearly 500 Feature Articles written with historytemplate.php My site is also open access but I do keep a few articles (eg about recent events; articles in draft) on closed view.

The method of control is, as Ron says, around the use of the $currentuser; variable - not actually within the historytemplate.php file itself, but on the menuing system. It is also possible to differentiate between "casual browsers", "trusted browsers" and logged on registered users.

If of interest, PM me and I will show you an example.

Alan 

 

Share this post


Link to post
Share on other sites
Roelj
10 hours ago, tngrlkrz said:

Take a look at restrict access mod and how it works or you can maybe add similar code to the history template php files,  perhaps.

You basically check for $currentuser, to allow or disallow. 

Ron 

Hello Ron,

Thank you for your reaction.
The restricted access-mod is a good solution for standard media, but does not bring the solution for my user pages as far as i can see.

Roel

Share this post


Link to post
Share on other sites
Roelj

PROBLEM SOLVED

After all it was quite simple to find the solution.:

  • First i have installed the restrict access-mod as Ron suggested
  • Then i put the following code in those user pages i want to hide using the functionallity of this mod:
    <?php
    if (! $currentuser) {
    @include($cms['tngpath'] . "data/extensions/noaccess.php");
    exit;
    }
    ?>
    This works fine for me.

Roel

Share this post


Link to post
Share on other sites
Roelj
On 12/24/2018 at 3:48 AM, tngrlkrz said:

Take a look at restrict access mod and how it works or you can maybe add similar code to the history template php files,  perhaps.

You basically check for $currentuser, to allow or disallow. 

Ron 

Hello Ron,

as i already wrote this was a good suggestion; it is exactly what i was looking for.
There is one thing i could not yet get working.
I noticed on your site that the randomimages are (for registered) users are clickable, but i could not find the code for that function.

Could you help me here also?

Regards,
Roel

Share this post


Link to post
Share on other sites
tngrlkrz

 Are you thinking of the random images on my homepage?  That is accomplished with the simple code added to  showmedia.php as you found works for you elsewhere:

 

include($cms['tngpath'] . "checklogin.php");
if( ! $currentuser ) {
    $showguest=1;
    include("extensions/noaccess.php");
    exit;

I also hide media menu items from visitors as well by checking the same variable.

Or am I misunderstanding your question?

Ron

Share this post


Link to post
Share on other sites
Roelj
9 hours ago, tngrlkrz said:

 Are you thinking of the random images on my homepage?  That is accomplished with the simple code added to  showmedia.php as you found works for you elsewhere:

 

include($cms['tngpath'] . "checklogin.php");
if( ! $currentuser ) {
    $showguest=1;
    include("extensions/noaccess.php");
    exit;

I also hide media menu items from visitors as well by checking the same variable.

Or am I misunderstanding your question?

Ron

Ron,

Thank you, this what i ment.
i got it working now. And the images not been clickable was caused by the mod 'randomimage for template' which i had installed. After removing it, it works fine.

Roel

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×