News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

How I can put some features of SSI on the guest page?

Started by yamezbond, December 20, 2003, 12:28:25 AM

Previous topic - Next topic

yamezbond

Hi, I'm new on php, well, here is the question and the story, first my forum is for register users only, so when I get to my forum www.techmonkeys.cjb.net I got just my forum template with the login table, but I wonder if I can put some more stuff on that page for the guest users, so they can see the lates recently post or the new members, or somenthing like that, I want to do this on php, I don't want to use another principal page like I did on my other board www.fufurufo.com which I use an shtml page and put some SSI functions on it, I wonder if I can put this directly to the first screeen that a guest see when get to my forum www.techmonkeys.cjb.net

Thank you!

yamezbond

Hello??
At least somebody say hi, is this forum death?

[Unknown]

Of course you can.  See ssi_examples.php.

-[Unknown]

pulpitfire

Quote from: yamezbond on December 20, 2003, 12:28:25 AM
Hi, I'm new on php, well, here is the question and the story, first my forum is for register users only, so when I get to my forum www.techmonkeys.cjb.net I got just my forum template with the login table, but I wonder if I can put some more stuff on that page for the guest users, so they can see the lates recently post or the new members, or somenthing like that, I want to do this on php, I don't want to use another principal page like I did on my other board www.fufurufo.com which I use an shtml page and put some SSI functions on it, I wonder if I can put this directly to the first screeen that a guest see when get to my forum www.techmonkeys.cjb.net

Thank you!

the thing is, if guests are not allowed to view your forum (i.e. you checked "dissallow guests from doing anything but logging in or registering" in your forum settings), putting recent posts SSI won't benefit them, since clicking them will again tell them they cannot view that area. 

you might want to uncheck the dissallow guests from doing anything but registering or posting, but also avoid checking the enable member post option.  This will allow them to view but not post.

if you want them to see the recent posts, even though they won't be able to read them, you can use the SSI, or you can add something like this directly to your regular forum login page:

1) put this in Subs.php (note: this will only show the message subject as a link to the article, and not the poster name, time, etc.).

Quote
function yyrecentp() {
   global $settings,$scripturl,$txt,$censored,$recentsender,$db_prefix, $post, $dummy,$showlatestcount,$showBoard,$showPoster,$showTime, $block, $prefs, $color;
   
   $display = 3;
   $request = mysql_query("SELECT m.smiliesEnabled,m.posterTime,m.ID_MEMBER,m.ID_MSG,m.subject,m.body,m.ID_TOPIC,t.ID_BOARD,b.name as bname,c.name as cname,m.posterName,t.numReplies FROM {$db_prefix}messages as m,{$db_prefix}topics as t,{$db_prefix}boards as b,{$db_prefix}categories as c WHERE (m.ID_TOPIC = t.ID_TOPIC AND t.ID_BOARD = b.ID_BOARD AND b.ID_CAT=c.ID_CAT AND (FIND_IN_SET('$settings[7]',c.memberGroups)!=0 OR c.memberGroups='' OR '$settings[7]'='Administrator' OR '$settings[7]'='Global Moderator')) ORDER BY m.posterTime DESC LIMIT $display");
   
   while ($curr_post = mysql_fetch_array($request)) {
      $block[contents] = $block[contents]."<a href=\"$scripturl?board=$curr_post[ID_BOARD];action=display;threadid=$curr_post[ID_TOPIC];boardseen=1\"><li>$curr_post[subject]</a><BR>";
      }
echo $block[contents];
   }


2. change display to the number of posts you want them to see

3. then just place a tag <yabb recentp>, in template.php, wherever you want it to appear.

if you prefer the style SSI uses (although I timed SSI vs. the query above, and the one above is WAY faster if you're using a lot of topics), just hack it into a Subs.php function like the one above.

yamezbond

Thanks for replying pege,  I'm not o good in PHP, is there  any other way to do it?  for example what is the exactly php page that the script load when it recognized that is a guest? is there any way to put any code in that page? or another example in phpbb2 I have the option to let guest view the topics of my board, but when they click on any topic the script take them to log in.
That is exactly what I want.

How I can make it on my board on the eazy way?

Thanks again!

pulpitfire

1. back up Index.php

2.  change

Quote
   if ($username == 'Guest' && $guestaccess == 0)
      if (!(($action == 'login') || ($action == 'login2') || ($action == 'register') || ($action == 'register2') || ($action == 'reminder')))
         KickGuest();

to

Quote
   if ($username == 'Guest' && $guestaccess == 0)
      if (!(($action == 'login') || ($action == 'login2') || ($action == 'register') || ($action == 'register2') || ($action == 'reminder') || ($action == '')))
         KickGuest();


yamezbond

Hi Pege,
I did exactly what you told me but nothing happen, guest still read everything.

Thanks!

pulpitfire

Quote from: yamezbond on December 22, 2003, 10:20:15 PM
Hi Pege,
I did exactly what you told me but nothing happen, guest still read everything.

Thanks!

you have to set your forum settings to disallow guests from doing anything but logging in or registering before that mod will work.  it should make it so they can view the Board and Message Index, but take them to login if they click a message subject.  I tried it on a board and it worked.  Let me know. 

yamezbond

Wow Pege, you are tha man!
it works!!

Thanks!! a lot!!!

pulpitfire


huijaa

Quote from: pege on December 22, 2003, 10:17:24 AM
1. back up Index.php

2. change

Quote
   if ($username == 'Guest' && $guestaccess == 0)
      if (!(($action == 'login') || ($action == 'login2') || ($action == 'register') || ($action == 'register2') || ($action == 'reminder')))
         KickGuest();

to

Quote
   if ($username == 'Guest' && $guestaccess == 0)
      if (!(($action == 'login') || ($action == 'login2') || ($action == 'register') || ($action == 'register2') || ($action == 'reminder') || ($action == '')))
         KickGuest();


Where can i find it in a version of 1.0.1 ?
Dovenforum Nederland -- a forum for deaf people in the Netherlands --

[Unknown]

Same file:

elseif (empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('login', 'login2', 'register', 'register2', 'reminder', 'activate', 'help', '.xml'))))

Change to:

elseif (empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && (!in_array($_REQUEST['action'], array('login', 'login2', 'register', 'register2', 'reminder', 'activate', 'help', '.xml'))))

-[Unknown]

Advertisement: