Log in Register FAQ Memberlist Search Welcome to RCF - WHF Forum Index
alt : test.swf
Welcome to RCF - WHF
4fx3.gif 
calendar_open_closeCalendar 
[Solved] Keep Unread Flags mod
Post new topic   Reply to topic View previous topic :: View next topic
Goto page: Previous  1, 2, 3  Next
Welcome to RCF - WHF Forum Index -> Area 51 - phpBB & Easymod Tech Support Add To Bookmarks
Re: Keep Unread Flags mod
PostPosted: 01/21/2007 8:37 PM Reply with quote
Site Admin
Nightrider
Site Admin
Posts 30757
Word Cnt. 2,628,690
BDay Jul 28
Sign Leo
Sex Sex:Male
Joined: Sep 25, 2004
Local time: 7:40 PM
Location: St Pete, FL
peace.gif
We could certainly try to guess what to do, but Alan should be able to tell you exactly what to do and he is the most likely one to be willing to do it...

munky2
Back to Top
View all pictures posted by this userView user's profile Find all posts by Nightrider Send private message   AIM Address Yahoo Messenger Phoogle Map ICQ Number
Re: [Solved] Keep Unread Flags mod
PostPosted: 01/21/2007 10:06 PM Reply with quote
Citation
KeeKee
Citation
Posts 940
Word Cnt. 48,215
BDay Mar 4
Sign Pisces
Sex Sex:Female
Joined: Mar 20, 2006
Local time: 6:40 PM
usaCa.gif
Thanks for the heads up.  I put in a post over there.  will let you know what happens.
Back to Top
View user's profile Find all posts by KeeKee Send private message   Visit poster's website Yahoo Messenger Phoogle Map ICQ Number
Re: Keep Unread Flags mod
PostPosted: 01/21/2007 10:28 PM Reply with quote
Site Admin
Nightrider
Site Admin
Posts 30757
Word Cnt. 2,628,690
BDay Jul 28
Sign Leo
Sex Sex:Male
Joined: Sep 25, 2004
Local time: 7:40 PM
Location: St Pete, FL
peace.gif
I hope you get a quick response...

headbang
Back to Top
View all pictures posted by this userView user's profile Find all posts by Nightrider Send private message   AIM Address Yahoo Messenger Phoogle Map ICQ Number
Re: [Solved] Keep Unread Flags mod
PostPosted: 01/22/2007 7:57 PM Reply with quote
Citation
KeeKee
Citation
Posts 940
Word Cnt. 48,215
BDay Mar 4
Sign Pisces
Sex Sex:Female
Joined: Mar 20, 2006
Local time: 6:40 PM
usaCa.gif
I did he ask did I look real well to see what the difference was. I do know there is another piece of that draft mod, guess I can copy paste that piece into the mod. But whether there is a blank space or something I wouldn't know.
I printed both parts out so I can go thru and highlight the same things. There is a lot there and switching from screen to screen isn't working too well.
Back to Top
View user's profile Find all posts by KeeKee Send private message   Visit poster's website Yahoo Messenger Phoogle Map ICQ Number
Re: Keep Unread Flags mod
PostPosted: 01/23/2007 12:36 PM Reply with quote
Site Admin
Nightrider
Site Admin
Posts 30757
Word Cnt. 2,628,690
BDay Jul 28
Sign Leo
Sex Sex:Male
Joined: Sep 25, 2004
Local time: 7:40 PM
Location: St Pete, FL
peace.gif
The problem is not in the FIND statement but in the REPLACE WITH command.  It is easy to tell EM what to find, but when a MOD author replaces large chunks of the standard code with their own, it poses a problem when other MODs had modified the same piece of code.  We need to get Alan to tell us how to guarantee that the Save Posts as Drafts MOD will work with their rewritten segment of code...

munky2
Back to Top
View all pictures posted by this userView user's profile Find all posts by Nightrider Send private message   AIM Address Yahoo Messenger Phoogle Map ICQ Number
Re: [Solved] Keep Unread Flags mod
PostPosted: 01/23/2007 4:18 PM Reply with quote
Citation
KeeKee
Citation
Posts 940
Word Cnt. 48,215
BDay Mar 4
Sign Pisces
Sex Sex:Female
Joined: Mar 20, 2006
Local time: 6:40 PM
usaCa.gif
o.k. I"ll see.
Back to Top
View user's profile Find all posts by KeeKee Send private message   Visit poster's website Yahoo Messenger Phoogle Map ICQ Number
Re: [Solved] Keep Unread Flags mod
PostPosted: 01/24/2007 10:13 PM Reply with quote
Citation
KeeKee
Citation
Posts 940
Word Cnt. 48,215
BDay Mar 4
Sign Pisces
Sex Sex:Female
Joined: Mar 20, 2006
Local time: 6:40 PM
usaCa.gif
O.K. guess I explained the problem correctly Al gave me a code to try in place of the one I have.  I will try it tomorrow, it's been a long day, I have an old cat that is in kidney failure she is taking a lot of time among other things around here but I got things cleared so I could concentrate on it tomorrow.
Back to Top
View user's profile Find all posts by KeeKee Send private message   Visit poster's website Yahoo Messenger Phoogle Map ICQ Number
Re: Keep Unread Flags mod
PostPosted: 01/24/2007 11:51 PM Reply with quote
Site Admin
Nightrider
Site Admin
Posts 30757
Word Cnt. 2,628,690
BDay Jul 28
Sign Leo
Sex Sex:Male
Joined: Sep 25, 2004
Local time: 7:40 PM
Location: St Pete, FL
peace.gif
It's been a while since I talked with him, but Alan used to be very helpful.  I'm glad that he was able to offer you replacement code.  I just wish they didn't rewrite so much of the standard code so that it would be easier to add the MOD.  They use REPLACE WITH commands far too much, IMO...

munky2
Back to Top
View all pictures posted by this userView user's profile Find all posts by Nightrider Send private message   AIM Address Yahoo Messenger Phoogle Map ICQ Number
Re: [Solved] Keep Unread Flags mod
PostPosted: 01/29/2007 6:32 PM Reply with quote
Citation
KeeKee
Citation
Posts 940
Word Cnt. 48,215
BDay Mar 4
Sign Pisces
Sex Sex:Female
Joined: Mar 20, 2006
Local time: 6:40 PM
usaCa.gif
This is what he had me replace.
Code:
#
#-----[ OPEN ]------------------------------------------------
#
viewtopic.php

#
#-----[ FIND ]------------------------------------------------
#
if (!$topic_id && !$post_id)
{
   message_die(GENERAL_MESSAGE, 'Topic_post_not_exist');
}

//
// Find topic id if user requested a newer
// or older topic
//
if ( isset($HTTP_GET_VARS['view']) && empty($HTTP_GET_VARS[POST_POST_URL]) )
{
   if ( $HTTP_GET_VARS['view'] == 'newest' )
   {
      if ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_sid']) || isset($HTTP_GET_VARS['sid']) )
      {
         $session_id = isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_sid']) ? $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_sid'] : $HTTP_GET_VARS['sid'];

         if (!preg_match('/^[A-Za-z0-9]*$/', $session_id))
         {
            $session_id = '';
         }

         if ( $session_id )
         {
            $sql = "SELECT p.post_id
               FROM " . POSTS_TABLE . " p, " . SESSIONS_TABLE . " s,  " . USERS_TABLE . " u
               WHERE s.session_id = '$session_id'
                  AND u.user_id = s.session_user_id
                  AND p.topic_id = $topic_id
                  AND p.post_time >= u.user_lastvisit
                  AND p.post_draft = 0
               ORDER BY p.post_time ASC
               LIMIT 1";
// start mod save posts as drafts (and end mod too): added an AND constraint in the foregoing sql definition that post_draft be zero (i.e. that the post not just be a draft)
            if ( !($result = $db->sql_query($sql)) )
            {
               message_die(GENERAL_ERROR, 'Could not obtain newer/older topic information', '', __LINE__, __FILE__, $sql);
            }

            if ( !($row = $db->sql_fetchrow($result)) )
            {
               message_die(GENERAL_MESSAGE, 'No_new_posts_last_visit');
            }

            $post_id = $row['post_id'];

            if (isset($HTTP_GET_VARS['sid']))
            {
               redirect("viewtopic.$phpEx?sid=$session_id&" . POST_POST_URL . "=$post_id#$post_id");
            }
            else
            {
               redirect("viewtopic.$phpEx?" . POST_POST_URL . "=$post_id#$post_id");
            }
         }
      }

      redirect(append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id", true));
   }

#
#-----[ REPLACE WITH ]------------------------------------------
#
//START MOD Keep_unread_2
$mode = ( isset($HTTP_GET_VARS['mode']) ) ? htmlspecialchars( $HTTP_GET_VARS['mode'] ) : '';

if ( !empty($post_id) )
{ //added topic_last_post_id, p.post_time to sql
   $sql = "SELECT t.forum_id, t.topic_id, t.topic_last_post_id, p.post_time
      FROM " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p
      WHERE t.topic_id = p.topic_id
      AND t.topic_moved_id = 0
      AND p.post_id = $post_id";
}
else if ( !empty($topic_id) )
{
   $sql = "SELECT t.forum_id, t.topic_id, t.topic_last_post_id
      FROM " . TOPICS_TABLE . " t
      WHERE t.topic_moved_id = 0
      AND t.topic_id = $topic_id";
}
else
{
   message_die(GENERAL_MESSAGE, 'Topic_post_not_exist');
}
if ( !$result = $db->sql_query($sql) )
{
   message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql);
}
if ( !$row = $db->sql_fetchrow($result) )
{
   message_die(GENERAL_MESSAGE, 'Topic_post_not_exist');
}
$forum_id = $row['forum_id'];
$topic_id = $row['topic_id'];
$post_time = $row['post_time'];
$topic_last_post_id = $row['topic_last_post_id'];
//END MOD Keep_unread_2

//
// Start session management
//
$userdata = session_pagestart($user_ip, $forum_id);
init_userprefs($userdata);
//
// End session management
//

//START MOD Keep_unread_2 * Keep topic unread from given post onwards
if ($mode == 'unread')
{
   $board_config['tracking_unreads'][$topic_id] = $post_time-1; //testing for ">" only later on
   write_cookies($userdata);
   $message = $lang['keep_unread_done'] . '<br /><br />' .
   sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">', '</a> ') . '<br /><br />' .
   sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a> ');
   message_die(GENERAL_MESSAGE, $message);
}
$topic_last_read = topic_last_read($forum_id, $topic_id);
//END MOD Keep_unread_2

//
// Find topic id if user requested a newer
// or older topic
//
if ( isset($HTTP_GET_VARS['view']) && empty($HTTP_GET_VARS[POST_POST_URL]) )
{
   if ( $HTTP_GET_VARS['view'] == 'newest' )
   { // read the first unread post in this topic
      $sql = "SELECT p.post_id, t.topic_last_post_id
         FROM (" . TOPICS_TABLE . " t
         LEFT JOIN " . POSTS_TABLE . " p ON p.topic_id = t.topic_id AND p.post_time > $topic_last_read)
         WHERE t.topic_id = $topic_id
         AND t.topic_moved_id = 0
         AND p.post_draft = 0
         ORDER BY p.post_time";
      if ( !$result = $db->sql_query($sql) )
      {
         message_die(GENERAL_ERROR, 'Could not obtain newer/older topic information', '', __LINE__, __FILE__, $sql);
      }

      if ( !($row = $db->sql_fetchrow($result)) )
      {
         message_die(GENERAL_MESSAGE, 'No_new_posts_last_visit');
      }
      $post_id = empty($row['post_id']) ? $row['topic_last_post_id'] : $row['post_id'];
      redirect(append_sid("./viewtopic.$phpEx?" . POST_POST_URL . "=$post_id#$post_id", true));
   }


I did that change.
Now EM is telling me I'm back to where I was that you had helped me with and from what I can tell I have replaced what you told me to.  It did go through when I tried it but after I made the change Alan told me to it dropped back to the first error.

Code:
Critical Error

FIND FAILED: In file [search.php] could not find:

if ( $userdata['session_logged_in'] )
{
$sql = "SELECT post_id
FROM " . POSTS_TABLE . "
WHERE post_time >= " . $userdata['user_lastvisit'] . " AND post_draft = 0";
// start mod save posts as drafts (and end mod too)...added constraint in the preceding line that post_draft be 0 so that draftws wouldn't get included
}
else
{
redirect(append_sid("login.$phpEx?redirect=search.$phpEx&search_id=ne wposts", true));
}
Back to Top
View user's profile Find all posts by KeeKee Send private message   Visit poster's website Yahoo Messenger Phoogle Map ICQ Number
Re: Keep Unread Flags mod
PostPosted: 01/30/2007 11:45 AM Reply with quote
Site Admin
Nightrider
Site Admin
Posts 30757
Word Cnt. 2,628,690
BDay Jul 28
Sign Leo
Sex Sex:Male
Joined: Sep 25, 2004
Local time: 7:40 PM
Location: St Pete, FL
peace.gif
The reason you got this error was because there was a space in the middle of the word newposts in the FIND redirect line.  I corrected that along with many other conflicts and successfully installed the Keep Unread Flags MOD onto your Pasadena forum.  I really have no way to test whether it is working correctly though, so you might want to look through it before installing this MOD into any of your other forums.  The Pasadena forum may not have enough traffic to thoroughly test it though...

munky2
Back to Top
View all pictures posted by this userView user's profile Find all posts by Nightrider Send private message   AIM Address Yahoo Messenger Phoogle Map ICQ Number
 Post new topic  Reply to topic
Information
Welcome to RCF - WHF Forum Index -> Area 51 - phpBB & Easymod Tech Support

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum
All times are GMT - 5 Hours
Goto page: Previous  1, 2, 3  Next
Page 2 of 3


Add To Bookmarks

 
  
  


  Google

Powered by phpBB © 2001, 2005 phpBB Group

Page generation time: 0.108s (PHP: 62% - SQL: 38%) - SQL queries: 57 - GZIP disabled - Debug on