UBB.Dev
Posted By: ehm How to make one thread apears only if NOT loged? - 12/05/2002 8:43 AM
I can see on this forum here that the "Most Forums Only Appear to Members " thread apears only if I'm not logged in.
Any tip how can I do it?
Thank you
I call those "teaser forums" to entice users who aren't logged in to register.

I've written a "how-to" document here in our How To/Site Help Library forum.

Hope that helps.
I'll add this....

Because I thin you posted this topic at the infopop community forum.

The "teaser forum" thing... keeps the forums hidden from users who aren't logged in.

I think you wanted users not logged in to be able to view the postlist.php page... but not view posts? Is that what you wanted?

That could be done by modifing showflat.php and showthreaded.php to not allow unregistered users to view.

Let me know if that's what you had in mind and I'll write that up.
you are doulbe right.
I post at infopop yes, but then, loking here I found that "teaser forum" and I tought it could at least solve part of my problem.
Now, if I still can have that changes you wrote on 'showflat.php' and 'showthreaded.php' would be perfect. Is it that hard to change? Do I have to have .php knowloge or not?
Any way I will check your post about 'teaser forum' and sorry to ask a question before look for the awnser. I hate when I do it.
Thank you
Elton
No real PHP knowledge is needed, if you can follow instructions and do some copy and paste with text files.

OK - backup these files first so you can go back if something goes wrong. You'll also need to put original files back if you need "official" Infopop support.

Modify at your own peril is the saying.... but this is fairly safe.
code:

In your showflat.php file.....

Find this:

// -----------------
// Get the user info
$userob = new user;
$user = $userob -> authenticate("U_Display, U_Groups,... [:"red"]edited for length[/]
$Username = $user['U_Username'];

$html = new html;



BELOW it, add this:

// ------------------
// Block anon users from viewing posts - by JoshPet
if (!$Username) {
$html -> not_right($ubbt_lang['NO_AUTH'],$Cat);
}


In you showthreaded.php file......


Find this:

// -----------------
// Get the user info
$userob = new user;
$user = $userob -> authenticate("U_Display, U_Groups,... [:"red"]edited for length[/]
$Username = $user['U_Username'];


BELOW it, add this:


// ------------------
// Block anon users from viewing posts - by JoshPet
if (!$Username) {
$html -> not_right($ubbt_lang['NO_AUTH'],$Cat);
}




That should do it.

Then allow those forums to be read by the "Guest" group. It will let them view the list of posts.... but when they click to view a thread, if they are not logged in, they will receive the error page telling them that they must be logged in.. etc.


I haven't tested... but this should work fine.... let me know how it works out for ya.
... [:"red"]edited for length[/]
I got error
Fatal error: Call to a member function on a non-object in .../forum/showthreaded.php on line 176

I change back and the error is gone, (but the function also is gone )
I checked the sintax with my poor PHP knolodge and looks fine for me, so there is another issue ?

Did I mention I'm using 6.1.1 Threaded ?
It's probably complaining because there's no "html" object. Try making this change in showthreaded.php:

code:
// ------------------
// Block anon users from viewing posts - by JoshPet
if (!$Username) {
[:"red"]$html = new html;[/]
$html -> not_right($ubbt_lang['NO_AUTH'],$Cat);
}

It's working
THank you.
I understand it wont happen on the non thread (flat) show, since that included is there one line before, am I right?
Thank you
Yes, you're right. showflat.php already has the $html = new html;
Ah good catch Dave. Showflat already had it. Forgot to notice that showthreaded didn't.

Thanks.

And yes Dave.... I edited the length just for you so you wouldn't yell at me for "wide posting again". LOL
© UBB.Developers