Welcome to Geeklog, Anonymous Tuesday, March 19 2024 @ 07:52 am EDT

Geeklog Forums

staticpages frontpage for only anonymous users


Status: offline

jlhughes

Forum User
Full Member
Registered: 04/25/02
Posts: 154
I have a site that requires that you sign in before you can access any features. I have created a staticpages frontpage nonews article.

The problem is that I didn't want this to be what people see after they sign in. Once signed in, I wanted people to see the regular collection of stories.

I found a very simple hack of the staticpages hack in index.php.

Find the line that says:

if (( empty($topic) ) )

and change it to:

if (( empty($topic) ) && (empty($_USER['uid'])) )

Now the staticpages hack tests for both no topic and no userid (an anonymous visitor).

 Quote

Status: offline

muskrat

Forum User
Chatty
Registered: 10/31/02
Posts: 41
Thanks, that's just what I want to do. Problem is, the line you indicated to look for does not appear in the index.php that I have for staticpages. Version problem maybe? The version I have has this at the top (for version checking purposes) // $Id: index.php,v 1.3 2002/04/23 04:22:03 mlimburg Exp $ I'm not clever enough w/PHP to find the corresponding place and change it...
 Quote

Anonymous

Anonymous
there are a few lines that say if (( empty($topic) ) ), but none of them are an exact match. is there an approximate line #? or...?

more questions still to come.

 Quote

Status: offline

odDonnellE

Forum User
Junior
Registered: 12/26/02
Posts: 24
if one follows these steps, what will the registered users see?----me
-Adam O'Donnell
 Quote

Status: offline

schmaxelander

Forum User
Newbie
Registered: 09/24/02
Posts: 10
Right now version 1.38 is actual. As in Id: index.php,v 1.38 2002/12/01 10:12:18 dhaun Exp
You should find the first line with something like if (empty ($topic)) and edit there.
Nevertheless I have another solution posted in another comment.

~ Alex
 Quote

Status: offline

schmaxelander

Forum User
Newbie
Registered: 09/24/02
Posts: 10
You should find the first line saying something like if (empty ($topic)) and edit there.
Should be around line 76 or so.
Nevertheless I posted another solution in another comment.

~ Alex
 Quote

Status: offline

schmaxelander

Forum User
Newbie
Registered: 09/24/02
Posts: 10
The loggid in user might see nothing... Frown
I posted a solution for this in another comment.

~ Alex
 Quote

Status: offline

schmaxelander

Forum User
Newbie
Registered: 09/24/02
Posts: 10
Got a solution for the problem of either showing the static page to anonymous users or not showing a page to loggid in users.
You could do something like this:
Text Formatted Code
// Get the title of the static page to use
if (empty ($topic)) {
    // Anonymous user get a special frontpage
    if ( empty($_USER['uid']) ) {
        $staticpage_title = 'anonymous_frontpage';
    } else {
        $staticpage_title = 'frontpage';
    }
}
Then the system choses the normal static page named 'frontpage' and shows it to every logged in user - or it choses 'anonymous_frontpage' and shows it to anonymous users.
So you can have a static page 'anonymous_frontpage' with content for anonymous users and a page 'frontpage' for logged in users.
Haven't yet found a way to do both but I think this solution might be better than nothing. Wink
BTW this also works with the hack by James Fryer where you can add a static page to every topic.

~ Alex
 Quote

All times are EDT. The time is now 07:52 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content