Welcome, Guest. Please Login or Register.
April 28, 2025, 03:21:45 PM
Home Help Search Log in Register
News: SMF is the next generation in forum software, almost completely re-written from the ground up, make sure you don't fall for cheap imitations that suffer from feature bloat!

YaBB SE Community  |  Development  |  Completed mods  |  [DONE] Mark as unread « previous next »
Pages: [1] Reply Ignore Print
Author Topic: [DONE] Mark as unread  (Read 2632 times)
sylvester
YaBB God
*****
Posts: 525


[DONE] Mark as unread
« on: July 06, 2002, 09:12:03 AM »
Reply with quote

<id>
Mark as unread
</id>

<version>
1
</version>

<author>
sylvester
[email protected]
</author>

<mod info>
If you've installed this, and 'mark as read' is enabled, you'll see a 'mark as unread' button on the bottom of a thread.
This mod allows you to check a TOPIC as unread, so you'll see a 'new' button :)
</mod info>

<edit file>
english.lng
</edit file>

<search for>
$locale = "en_US";
</search for>

<add after>
$txt['markunread'] = "Mark this topic as unread";
</add after>

<edit file>
index.php
</edit file>

<search for>
      if ($action == 'markasread') { include_once "$sourcedir/MessageIndex.php"; MarkRead(); }
</search for>

<add after>
      else if ($action == 'markasunread') { include_once "$sourcedir/MessageIndex.php"; MarkAsUnread(); }
</add after>

<edit file>
Sources/MessageIndex.php
</edit file>

<search for>
function MarkRead() {
   # Mark all threads in this board as read.
   global $currentboard,$username,$db_prefix;
   $request = mysql_query("SELECT logTime FROM {$db_prefix}log_mark_read WHERE (ID_BOARD=$currentboard && memberName='$username')");
   if (mysql_num_rows($request) == 0)
      $request = mysql_query("INSERT INTO {$db_prefix}log_mark_read (logTime,ID_BOARD,memberName) VALUES (".time().",$currentboard,'$username')");
   else
      $request = mysql_query("UPDATE {$db_prefix}log_mark_read SET logTime=".time()." WHERE (ID_BOARD=$currentboard && memberName='$username')");

   MessageIndex();
   obExit();
}
</search for>

<add after>
function MarkAsUnread() {
   global $db_prefix,$threadid,$username,$showmarkread;
   if($username == 'Guest') { fatal_error($txt[138]; }
    if($showmarkread != '1') { fatal_error($txt['yse63']); }
      $request = mysql_query("DELETE FROM {$db_prefix}log_topics WHERE ID_TOPIC='$threadid' AND memberName='$username'");
   MessageIndex();
   obExit();
}
</add after>

<edit file>
Sources/Display.php
</edit file>

<search for>
   global $moderators,$modSettings,$viewResults,$realNames,$db_prefix,$yySetLocation,$boardseen;
</search for>

<add after>
   global $showmarkread;
</add after>

<search for>
$pollHtml .=<<<EOT
         </td></tr></table></td>
      </tr>
    </table>
    </td>
  </tr>
</table>
EOT;
   }
</search for>

<add after>
$markunread = ($username != "Guest" && $showmarkread == "1")?"$menusep<a href=\"$cgi;action=markasunread;threadid=$threadid\"><IMG SRC=\"$imagesdir/markunread.gif\" BORDER=\"\" ALT=\"$txt[markunread]\" ALIGN=\"absmiddle\"></a>":"";
</add after>

<search for>
 $reply$notify$menusep<a href="$cgi;action=sendtopic;threadid=$viewnum">$img[sendtopic]</a>$menusep<a href="$printurl?board=$currentboard;threadid=$viewnum" target="_blank">$img[printt]</a>
</search for>

<add after>
$markunread>
</add after>

Requested by David :)
Put in your imagesdir
« Last Edit: August 11, 2002, 09:06:43 PM by sylvester » Logged

I'm back
GWP
Sr. Member
****
Posts: 252


A total PHP MySQL Novice :) - but getting better!

Re:[done] Mark as unread
« Reply #1 on: July 11, 2003, 08:14:58 AM »
Reply with quote

Quote<edit file>
index.php
</edit file>

<search for>
     if ($action == 'markasread') { include_once "$sourcedir/MessageIndex.php"; MarkRead(); }
</search for>
I cannot find any reference to this line in Index.php.
I did find
Quote$actionArray = array(
'markasread' => array("$sourcedir/MessageIndex.php", 'MarkRead'),
Could i just add something in here to make this mod work.
I'm using YaBB SE 1.5.1RC1/1.5.4
Logged

YabbSE 1.5.1rc Mods:AdvIm, Member Map, Password Prompt, Report to mod, Smilies SE 2.0, Bio, collapsable_yabb, Ignore user, Name, allowed user, search member, enchanced ban, posts per day, Mute User, Memberlist Plus,Who,ExactPostLink. Remove_Clicklog,mc_BoldOwnThreads.QuickReply, UserEnableDisableCensor, RefererMod, lastlogin_profile,PostBasedImRestrict, ExactPostLink, UserBrowsing,
[Unknown]
Global Moderator
YaBB God
*****
Posts: 7830


ICQ - 179721867unknownbrackets@hotmail.com WWW
Re:[done] Mark as unread
« Reply #2 on: July 11, 2003, 01:53:33 PM »
Reply with quote

Cool.... I've been thinking to myself that this would be useful, and almost writing it for about a week.

I didn't realize it had already been written.

-[Unknown]
« Last Edit: July 11, 2003, 04:05:44 PM by [Unknown] » Logged
GWP
Sr. Member
****
Posts: 252


A total PHP MySQL Novice :) - but getting better!

Re:[done] Mark as unread
« Reply #3 on: July 11, 2003, 03:32:30 PM »
Reply with quote

Well, far from me to stop you [Unknown]  ;)
As you can see, i have lots of your mods on my board.

I don't know about issues with the original mod writer though?
Logged

YabbSE 1.5.1rc Mods:AdvIm, Member Map, Password Prompt, Report to mod, Smilies SE 2.0, Bio, collapsable_yabb, Ignore user, Name, allowed user, search member, enchanced ban, posts per day, Mute User, Memberlist Plus,Who,ExactPostLink. Remove_Clicklog,mc_BoldOwnThreads.QuickReply, UserEnableDisableCensor, RefererMod, lastlogin_profile,PostBasedImRestrict, ExactPostLink, UserBrowsing,
[Unknown]
Global Moderator
YaBB God
*****
Posts: 7830


ICQ - 179721867unknownbrackets@hotmail.com WWW
Re:[done] Mark as unread
« Reply #4 on: July 11, 2003, 04:05:18 PM »
Reply with quote

Bah, I'll just post updated code here....

<id>
Mark as unread
</id>

<version>
1
</version>

<author>
sylvester
[email protected]
</author>

<mod info>
If you've installed this, and 'mark as read' is enabled, you'll see a 'mark as unread' button on the bottom of a thread.
This mod allows you to check a TOPIC as unread, so you'll see a 'new' button :)
</mod info>

<edit file>
english.lng
</edit file>

<search for>
$locale = 'en_US';
</search for>

<add after>
$txt['markunread'] = 'Mark this topic as unread';
</add after>

<edit file>
index.php
</edit file>

<search for>
      'markasread' => array("$sourcedir/MessageIndex.php", 'MarkRead'),
</search for>

<add after>
      'markasunread' => array("$sourcedir/MessageIndex.php", 'MarkAsUnread'),
</add after>

<edit file>
Sources/MessageIndex.php
</edit file>

<search for>
function MarkRead()
{
   # Mark all threads in this board as read.
   global $currentboard,$ID_MEMBER,$db_prefix;
   $request = mysql_query("REPLACE INTO {$db_prefix}log_mark_read (logTime,ID_BOARD,ID_MEMBER) VALUES (".time().",$currentboard,$ID_MEMBER)") or database_error(__FILE__, __LINE__);

   $result = mysql_query("
      SELECT lt.ID_TOPIC
      FROM {$db_prefix}log_topics AS lt, {$db_prefix}topics AS t
      WHERE t.ID_TOPIC=lt.ID_TOPIC
         AND t.ID_BOARD=$currentboard
         AND lt.ID_MEMBER=$ID_MEMBER") or database_error(__FILE__, __LINE__);
   if (mysql_num_rows($result) > 0)
   {
      $topics = array();
      while ($row = mysql_fetch_assoc($result))
         $topics[] = $row['ID_TOPIC'];
      $request = mysql_query("DELETE FROM {$db_prefix}log_topics WHERE ID_MEMBER=$ID_MEMBER AND ID_TOPIC IN (" . implode(',', $topics) . ")") or database_error(__FILE__, __LINE__);
   }


   MessageIndex();
   obExit();
}
</search for>

<add after>
function MarkAsUnread() {
  global $db_prefix, $threadid, $username, $showmarkread, $ID_MEMER;
  if ($username == 'Guest')
     fatal_error($txt[138];
  if ($showmarkread != '1')
     fatal_error($txt['yse63']);

  $request = mysql_query("
     DELETE FROM {$db_prefix}log_topics
     WHERE ID_TOPIC='$threadid'
        AND ID_MEMBER=$ID_MEMBER");

  MessageIndex();
  obExit();
}
</add after>

<edit file>
Sources/Display.php
</edit file>

<search for>
   global $sourcedir, $sc, $prev_next;
</search for>

<add after>
  global $showmarkread;
</add after>

<search for>
      $pollHtml .= '
                                 </td>
                              </tr>
                           </table>
                        </td>
                     </tr>
                  </table>
               </td>
            </tr>
         </table>';
   }
</search for>

<add after>
$markunread = ($username != 'Guest' && $showmarkread == '1') ? $menusep . '<a href="' . $cgi . ';action=markasunread;threadid=' . $threadid . '"><img src="' . $imagesdir . '/markunread.gif" border="0" alt="' . $txt['markunread'] . '" align="absmiddle"></a>' : '';
</add after>

<search for>
   $topicButtons[] = '<a href="' . $cgi . ';action=printpage;threadid=' . $viewnum . '" target="_blank">' . $img['printt'] . '</a>';
</search for>

<add after>
   $topicButtons[] = $markunread;
</add after>


-[Unknown]
Logged
GWP
Sr. Member
****
Posts: 252


A total PHP MySQL Novice :) - but getting better!

Re:[done] Mark as unread
« Reply #5 on: July 11, 2003, 04:20:13 PM »
Reply with quote

[Unknown] what version of yabbSE is this for as i got errors in steps 2,3,4,5,6. ??
Logged

YabbSE 1.5.1rc Mods:AdvIm, Member Map, Password Prompt, Report to mod, Smilies SE 2.0, Bio, collapsable_yabb, Ignore user, Name, allowed user, search member, enchanced ban, posts per day, Mute User, Memberlist Plus,Who,ExactPostLink. Remove_Clicklog,mc_BoldOwnThreads.QuickReply, UserEnableDisableCensor, RefererMod, lastlogin_profile,PostBasedImRestrict, ExactPostLink, UserBrowsing,
GWP
Sr. Member
****
Posts: 252


A total PHP MySQL Novice :) - but getting better!

Re:[done] Mark as unread
« Reply #6 on: July 11, 2003, 04:45:45 PM »
Reply with quote

[UnKnown]
I modded your mod (?) and came up with this, only minor spacing changes.
Quote<id>
Mark as unread
</id>

<version>
1
</version>

<author>
sylvester
[email protected]
</author>

<mod info>
If you've installed this, and 'mark as read' is enabled, you'll see a 'mark as unread' button on the bottom of a thread.
This mod allows you to check a TOPIC as unread, so you'll see a 'new' button :)
</mod info>

<edit file>
english.lng
</edit file>

<search for>
$locale = 'en_US';
</search for>

<add after>
$txt['markunread'] = 'Mark this topic as unread';
</add after>

<edit file>
index.php
</edit file>

<search for>
      'markasread' => array("$sourcedir/MessageIndex.php", 'MarkRead'),
</search for>

<add after>
               'markasunread' => array("$sourcedir/MessageIndex.php", 'MarkAsUnread'),
</add after>

<edit file>
Sources/MessageIndex.php
</edit file>

<search for>
function MarkRead()
{
   # Mark all threads in this board as read.
   global $currentboard,$ID_MEMBER,$db_prefix;
   $request = mysql_query("REPLACE INTO {$db_prefix}log_mark_read (logTime,ID_BOARD,ID_MEMBER) VALUES (".time().",$currentboard,$ID_MEMBER)") or database_error(__FILE__, __LINE__);

   $result = mysql_query("
      SELECT lt.ID_TOPIC
      FROM {$db_prefix}log_topics AS lt, {$db_prefix}topics AS t
      WHERE t.ID_TOPIC=lt.ID_TOPIC
         AND t.ID_BOARD=$currentboard
         AND lt.ID_MEMBER=$ID_MEMBER") or database_error(__FILE__, __LINE__);
   if (mysql_num_rows($result) > 0)
   {
      $topics = array();
      while ($row = mysql_fetch_assoc($result))
         $topics[] = $row['ID_TOPIC'];
      $request = mysql_query("DELETE FROM {$db_prefix}log_topics WHERE ID_MEMBER=$ID_MEMBER AND ID_TOPIC IN (" . implode(',', $topics) . ")") or database_error(__FILE__, __LINE__);
   }


   MessageIndex();
   obExit();
}
</search for>

<add after>
function MarkAsUnread() {
 global $db_prefix, $threadid, $username, $showmarkread, $ID_MEMER;
 if ($username == 'Guest')
     fatal_error($txt[138];
 if ($showmarkread != '1')
     fatal_error($txt['yse63']);

 $request = mysql_query("
     DELETE FROM {$db_prefix}log_topics
     WHERE ID_TOPIC='$threadid'
       AND ID_MEMBER=$ID_MEMBER");

 MessageIndex();
 obExit();
}
</add after>

<edit file>
Sources/Display.php
</edit file>

<search for>
   global $sourcedir, $sc, $prev_next;
</search for>

<add after>
 global $showmarkread;
</add after>

<search for>
      $pollHtml .= '
                                 </td>
                              </tr>
                           </table>
                        </td>
                     </tr>
                  </table>
               </td>
            </tr>
         </table>';
   }
</search for>

<add after>
$markunread = ($username != 'Guest' && $showmarkread == '1') ? $menusep . '<a href="' . $cgi . ';action=markasunread;threadid=' . $threadid . '"><img src="' . $imagesdir . '/markunread.gif" border="0" alt="' . $txt['markunread'] . '" align="absmiddle"></a>' : '';
</add after>

<search for>
   $topicButtons[] = '<a href="' . $cgi . ';action=printpage;threadid=' . $viewnum . '" target="_blank">' . $img['printt'] . '</a>';
</search for>

<add after>
  $topicButtons[] = $markunread;
</add after>
It gave me this error on my board

Quote<b>Parse error</b>:  parse error, unexpected ';' in <b>/home/.sites/58/site34/web/forum/Sources/MessageIndex.php</b> on line <b>484</b><br />
-^

Any Clues?
Logged

YabbSE 1.5.1rc Mods:AdvIm, Member Map, Password Prompt, Report to mod, Smilies SE 2.0, Bio, collapsable_yabb, Ignore user, Name, allowed user, search member, enchanced ban, posts per day, Mute User, Memberlist Plus,Who,ExactPostLink. Remove_Clicklog,mc_BoldOwnThreads.QuickReply, UserEnableDisableCensor, RefererMod, lastlogin_profile,PostBasedImRestrict, ExactPostLink, UserBrowsing,
GWP
Sr. Member
****
Posts: 252


A total PHP MySQL Novice :) - but getting better!

Re:[done] Mark as unread
« Reply #7 on: July 11, 2003, 04:48:26 PM »
Reply with quote

BTW
The "mark as unread" image in the first post...

If you right click to "save as" it comes up with "untitled.bmp", so you have to save it and convert it to a gif file called "markunread.gif" as save it to your YabbImages directory
Logged

YabbSE 1.5.1rc Mods:AdvIm, Member Map, Password Prompt, Report to mod, Smilies SE 2.0, Bio, collapsable_yabb, Ignore user, Name, allowed user, search member, enchanced ban, posts per day, Mute User, Memberlist Plus,Who,ExactPostLink. Remove_Clicklog,mc_BoldOwnThreads.QuickReply, UserEnableDisableCensor, RefererMod, lastlogin_profile,PostBasedImRestrict, ExactPostLink, UserBrowsing,
[Unknown]
Global Moderator
YaBB God
*****
Posts: 7830


ICQ - 179721867unknownbrackets@hotmail.com WWW
Re:[done] Mark as unread
« Reply #8 on: July 11, 2003, 07:08:27 PM »
Reply with quote

Change this:

fatal_error($txt[138];

To:

fatal_error($txt[138]);

-[Unknown]
Logged
GWP
Sr. Member
****
Posts: 252


A total PHP MySQL Novice :) - but getting better!

Re:[done] Mark as unread
« Reply #9 on: July 11, 2003, 09:32:59 PM »
Reply with quote

Thanks -[Unknown], that has fixed the error but i cannot see the "unread" button anywhere?
(I have mark as unread" enabled)
Logged

YabbSE 1.5.1rc Mods:AdvIm, Member Map, Password Prompt, Report to mod, Smilies SE 2.0, Bio, collapsable_yabb, Ignore user, Name, allowed user, search member, enchanced ban, posts per day, Mute User, Memberlist Plus,Who,ExactPostLink. Remove_Clicklog,mc_BoldOwnThreads.QuickReply, UserEnableDisableCensor, RefererMod, lastlogin_profile,PostBasedImRestrict, ExactPostLink, UserBrowsing,
[Unknown]
Global Moderator
YaBB God
*****
Posts: 7830


ICQ - 179721867unknownbrackets@hotmail.com WWW
Re:[done] Mark as unread
« Reply #10 on: July 11, 2003, 10:28:39 PM »
Reply with quote

I'd have to mess with it more.  That was just a pretty direct conversion.

The order might have changed... I dunno.

-[Unknown]
Logged
GWP
Sr. Member
****
Posts: 252


A total PHP MySQL Novice :) - but getting better!

Re:[done] Mark as unread
« Reply #11 on: July 11, 2003, 10:51:33 PM »
Reply with quote

OK, I'll leave it up as it doesn't change anything to do with my board.
Logged

YabbSE 1.5.1rc Mods:AdvIm, Member Map, Password Prompt, Report to mod, Smilies SE 2.0, Bio, collapsable_yabb, Ignore user, Name, allowed user, search member, enchanced ban, posts per day, Mute User, Memberlist Plus,Who,ExactPostLink. Remove_Clicklog,mc_BoldOwnThreads.QuickReply, UserEnableDisableCensor, RefererMod, lastlogin_profile,PostBasedImRestrict, ExactPostLink, UserBrowsing,
GWP
Sr. Member
****
Posts: 252


A total PHP MySQL Novice :) - but getting better!

Re:[done] Mark as unread
« Reply #12 on: July 22, 2003, 07:37:04 PM »
Reply with quote

Hi [Unknown]
Have you had time to look at this yet.
I think it will be really useful
Logged

YabbSE 1.5.1rc Mods:AdvIm, Member Map, Password Prompt, Report to mod, Smilies SE 2.0, Bio, collapsable_yabb, Ignore user, Name, allowed user, search member, enchanced ban, posts per day, Mute User, Memberlist Plus,Who,ExactPostLink. Remove_Clicklog,mc_BoldOwnThreads.QuickReply, UserEnableDisableCensor, RefererMod, lastlogin_profile,PostBasedImRestrict, ExactPostLink, UserBrowsing,
Pages: [1] Reply Ignore Print 
YaBB SE Community  |  Development  |  Completed mods  |  [DONE] Mark as unread « previous - next »
 


Powered by MySQL Powered by PHP YaBB SE Community | Powered by YaBB SE
© 2001-2003, YaBB SE Dev Team. All Rights Reserved.
SMF 2.1.4 © 2023, Simple Machines
Valid XHTML 1.0! Valid CSS

Page created in 0.047 seconds with 16 queries.