UBB.Dev
Posted By: havoq Logged In Users, Forum Announcement - 03/06/2005 8:30 PM
I was looking into a quick hack to only allow logged in users to view each forum announcement. Guests will see nothing, logged in users will see whats supposed to be there.

I know its in ubb_forum, and this is what I have by default

Code
	# get forum record
@this_forum = &GetForumRecord($in{f});
chomp($this_forum[15]); # <- sort option (new)

chomp($this_forum[16]) if $this_forum[16]; # <- new forum intro/announcement

$this_forum[16] = "" unless $this_forum[16];
I need to place this line of code somewhere I think, but Im having a hard to figuring it out?

Code
	# user must be logged in!
unless ($username ne '') {
&StandardHTML(qq!$vars_wordlets_err{not_logged_in}

<a href="$vars_config{CGIURL}/ultimatebb.cgi?ubb=login">$vars_wordlets{login_now}</a> $vars_wordlets{or} <a href="$vars_config{CGIURL}/ultimatebb.cgi?ubb=agree">$vars_wordlets{register_title}</a>!);
}
Any help would be greatly appreciated! wink
Posted By: Charles Capps Re: Logged In Users, Forum Announcement - 03/06/2005 10:01 PM
&RequireUserLogin; is your friend.
Posted By: havoq Re: Logged In Users, Forum Announcement - 03/06/2005 10:51 PM
not in 6.3 it isnt tipsy
Posted By: Ian Spence Re: Logged In Users, Forum Announcement - 03/07/2005 1:54 AM
*whispers to Charles*
you want to tell him to upgrade, or shall I?
Posted By: havoq Re: Logged In Users, Forum Announcement - 03/07/2005 3:40 AM
well i got it to work, but not well with the cache
Posted By: havoq Re: Logged In Users, Forum Announcement - 03/07/2005 6:16 PM
I mean, is there any reason why the forum summary announcement works flawlessly with the cache and the individual forum ann, dont?

By that I mean, if you are a guest, it wont show the ann. Then if you log in, and go back to that forum it still wont show. If you wait 4-5 min and go into the forum, then it will. Cache problem. Any solutions?
Posted By: Ian Spence Re: Logged In Users, Forum Announcement - 03/07/2005 6:26 PM
why aren't you just using class="ip-is-loggedin"
Posted By: havoq Re: Logged In Users, Forum Announcement - 03/07/2005 6:52 PM
I dunno, I dont even have that class. What benefit would that do me? Which file? Is that a built in class then obviously Im not aware of?
Posted By: Ian Spence Re: Logged In Users, Forum Announcement - 03/07/2005 7:08 PM
it is a built-in class available on all pages.

Code
<div class="ip-is-loggedin">You are logged in</div>
<div class="ip-is-notloggedin">You are not logged in, please register</div>
That way you won't even need to worry about the cache
Posted By: Ian Spence Re: Logged In Users, Forum Announcement - 03/07/2005 7:22 PM
lol, I just noticed it's what you are using for your forum summary.



It's a good idea, I actually did that a couple weeks ago
Posted By: havoq Re: Logged In Users, Forum Announcement - 03/07/2005 7:55 PM
Well if u use that in ubb_forum.cgi, wont that disable them from even viewing the forum?

Im still confused...I can show you the if statement I wrote to disable guests from seeing forum announcements
Posted By: Ian Spence Re: Logged In Users, Forum Announcement - 03/07/2005 8:45 PM
you don't need any hacks, or anything. just enclose whatever you want to show only to members in that div.
Posted By: havoq Re: Logged In Users, Forum Announcement - 03/07/2005 9:07 PM
That works, but it doesnt. See its reversed. It shows for guests and not the users. I want it to show for the users, and not the guests.

But ya, I like that way if we can tweeak it wink
Posted By: Ian Spence Re: Logged In Users, Forum Announcement - 03/07/2005 9:09 PM
then use ip-is-loggedin as the class tipsy
Posted By: havoq Re: Logged In Users, Forum Announcement - 03/07/2005 9:15 PM
nice, works very flawlessely laugh
© UBB.Developers