Skip to content
This repository was archived by the owner on Mar 8, 2021. It is now read-only.

Commit 8eb0331

Browse files
committedJan 25, 2016
View or Mark Unread Posts: apply mod version 1.0.9
[http://www.phpbb.com/customise/db/mod/view_or_mark_unread_posts] Updated all templates. (cherry picked from commit 1cc3eaa)
1 parent 29932d8 commit 8eb0331

23 files changed

+468
-23
lines changed
 

‎common.php

+3
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@
9898
require($phpbb_root_path . 'includes/constants.' . $phpEx);
9999
require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx);
100100
require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
101+
// start mod view or mark unread posts
102+
require($phpbb_root_path . 'includes/functions_view_or_mark_unread_posts.' . $phpEx);
103+
// end mod view or mark unread posts
101104

102105
// Set PHP error handler to ours
103106
set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler');

‎includes/constants.php

+2
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@
137137
define('LOG_USERS', 3);
138138

139139
// Private messaging - Do NOT change these values
140+
// start mod view or mark unread posts (and end mod too)...added the next line
141+
define('PRIVMSGS_UNREADBOX', -5);
140142
define('PRIVMSGS_HOLD_BOX', -4);
141143
define('PRIVMSGS_NO_BOX', -3);
142144
define('PRIVMSGS_OUTBOX', -2);

‎includes/functions.php

+8-2
Original file line numberDiff line numberDiff line change
@@ -1850,15 +1850,15 @@ function get_unread_topics($user_id = false, $sql_extra = '', $sql_sort = '', $s
18501850
),
18511851

18521852
'WHERE' => "
1853-
t.topic_last_post_time > $last_mark AND
18541853
(
18551854
(tt.mark_time IS NOT NULL AND t.topic_last_post_time > tt.mark_time) OR
18561855
(tt.mark_time IS NULL AND ft.mark_time IS NOT NULL AND t.topic_last_post_time > ft.mark_time) OR
1857-
(tt.mark_time IS NULL AND ft.mark_time IS NULL)
1856+
(tt.mark_time IS NULL AND ft.mark_time IS NULL AND t.topic_last_post_time > $last_mark)
18581857
)
18591858
$sql_extra
18601859
$sql_sort",
18611860
);
1861+
// start mod view or mark unread posts (and end mod too)...reverted a 3.0.9 change to the WHERE clause above since that change is inconsistent with this mod
18621862

18631863
$sql = $db->sql_build_query('SELECT', $sql_array);
18641864
$result = $db->sql_query_limit($sql, $sql_limit, $sql_limit_offset);
@@ -4634,6 +4634,9 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0
46344634
}
46354635
}
46364636

4637+
// start mod view or mark unread posts - set flag that toggles text for link to unreads (if user not logged in or board not using db for unreads, set to true so that text will always read view unreads
4638+
$s_exists_unreads = check_unread_posts();
4639+
// end mod view or mark unread posts
46374640
// The following assigns all _common_ variables that may be used at any point in a template.
46384641
$template->assign_vars(array(
46394642
'SITENAME' => $config['sitename'],
@@ -4680,6 +4683,9 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0
46804683
'U_SEARCH_SELF' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=egosearch'),
46814684
'U_SEARCH_NEW' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=newposts'),
46824685
'U_SEARCH_UNANSWERED' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=unanswered'),
4686+
// start mod view or mark unread posts
4687+
'S_EXISTS_UNREADS' => $s_exists_unreads,
4688+
// end mod view or mark unread posts
46834689
'U_SEARCH_UNREAD' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=unreadposts'),
46844690
'U_SEARCH_ACTIVE_TOPICS'=> append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=active_topics'),
46854691
'U_DELETE_COOKIES' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=delete_cookies'),

‎includes/functions_display.php

+20
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,17 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
309309

310310
// Used to tell whatever we have to create a dummy category or not.
311311
$last_catless = true;
312+
// start mod view or mark unread post
313+
// initialize the flag $exists_unread to signal that we have already checked unreads in functions_display()
314+
// so that when check_unread_posts() is called in the future it can skip the sql query and give the
315+
// answer that there are none (this gets reset to '1' later on in functions_display() if there are unreads),
316+
// but do NOT initialize if the user is on viewforum since the test for unreads may give false negatives in that context
317+
if (!$sql_where)
318+
{
319+
global $exists_unreads;
320+
$exists_unreads = -1;
321+
}
322+
// end mod view or mark unread posts
312323
foreach ($forum_rows as $row)
313324
{
314325
// Empty category
@@ -400,6 +411,15 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
400411
}
401412
}
402413

414+
// start mod view or mark unread posts
415+
if ($forum_unread)
416+
{
417+
// if there are any unread topics, set $exists_unreads flag to 1 so that
418+
// when check_unreads_flag() is called in the future it can skip the sql query
419+
// and give the answer that there are unread posts'
420+
$exists_unreads = 1;
421+
}
422+
// end mod view or mark unread posts
403423
// Which folder should we display?
404424
if ($row['forum_status'] == ITEM_LOCKED)
405425
{

‎includes/functions_privmsgs.php

+54-5
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,16 @@ function get_folder($user_id, $folder_id = false)
133133
$result = $db->sql_query($sql);
134134

135135
$num_messages = $num_unread = array();
136+
// start mod view or mark unread posts
137+
// edited the block below to keep track of $total_board_unreads
138+
$total_board_unreads = 0;
136139
while ($row = $db->sql_fetchrow($result))
137140
{
138141
$num_messages[(int) $row['folder_id']] = $row['num_messages'];
139142
$num_unread[(int) $row['folder_id']] = $row['num_unread'];
143+
$total_board_unreads += $row['num_unread'];
140144
}
145+
// end mod view or mark unread posts
141146
$db->sql_freeresult($result);
142147

143148
// Make sure the default boxes are defined
@@ -193,10 +198,19 @@ function get_folder($user_id, $folder_id = false)
193198
'unread_messages' => $num_unread[PRIVMSGS_SENTBOX]
194199
);
195200

201+
// start mod view or mark unread posts
202+
$folder[PRIVMSGS_UNREADBOX] = array(
203+
'folder_name' => $user->lang['UNREAD_MESSAGES'],
204+
'num_messages' => $total_board_unreads,
205+
'unread_messages' => $total_board_unreads
206+
);
207+
//end mod view or mark unread posts
208+
196209
// Define Folder Array for template designers (and for making custom folders usable by the template too)
197210
foreach ($folder as $f_id => $folder_ary)
198211
{
199-
$folder_id_name = ($f_id == PRIVMSGS_INBOX) ? 'inbox' : (($f_id == PRIVMSGS_OUTBOX) ? 'outbox' : 'sentbox');
212+
// start mod view or mark unread posts (and end mod too)...added reference to unreads in next line
213+
$folder_id_name = ($f_id == PRIVMSGS_INBOX) ? 'inbox' : (($f_id == PRIVMSGS_OUTBOX) ? 'outbox' : (($f_id == PRIVMSGS_UNREADBOX) ? 'unreadbox' : 'sentbox'));
200214

201215
$template->assign_block_vars('folder', array(
202216
'FOLDER_ID' => $f_id,
@@ -920,14 +934,44 @@ function handle_mark_actions($user_id, $mark_action)
920934
return false;
921935
}
922936

937+
// start mod view or mark unread posts (and end mod too)...in next line,
938+
// we define a variable that will allow us to ignore $cur_folder_id constraint
939+
// in queries when we are talking about unreadbox (since that's not a real folder);
940+
// then, we use that variable rather than 'folder_id = $cur_folder_id' in the first three cases in the switch below.
941+
$cur_folder_sql = ($cur_folder_id != PRIVMSGS_UNREADBOX) ? "folder_id = $cur_folder_id AND" : '';
923942
switch ($mark_action)
924943
{
944+
// start mod view or mark unread posts
945+
case 'mark_marked_read':
946+
947+
$sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . "
948+
SET pm_unread = 0
949+
WHERE $cur_folder_sql
950+
user_id = $user_id
951+
AND " . $db->sql_in_set('msg_id', $msg_ids);
952+
$db->sql_query($sql);
953+
update_pm_counts();
954+
955+
break;
956+
957+
case 'mark_marked_unread':
958+
959+
$sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . "
960+
SET pm_unread = 1
961+
WHERE $cur_folder_sql
962+
user_id = $user_id
963+
AND " . $db->sql_in_set('msg_id', $msg_ids);
964+
$db->sql_query($sql);
965+
update_pm_counts();
966+
967+
break;
968+
// end mod view or mark unread posts
925969
case 'mark_important':
926970

927971
$sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . "
928972
SET pm_marked = 1 - pm_marked
929-
WHERE folder_id = $cur_folder_id
930-
AND user_id = $user_id
973+
WHERE $cur_folder_sql
974+
user_id = $user_id
931975
AND " . $db->sql_in_set('msg_id', $msg_ids);
932976
$db->sql_query($sql);
933977

@@ -982,6 +1026,11 @@ function delete_pm($user_id, $msg_ids, $folder_id)
9821026

9831027
$user_id = (int) $user_id;
9841028
$folder_id = (int) $folder_id;
1029+
// start mod view or mark unread posts (and end mod too)...in next line,
1030+
// we define a variable that will allow us to ignore $folder_id constraint
1031+
// in queries when we are talking about unreadbox (since that's not a real folder);
1032+
// then, we use that variable rather than 'folder_id = $folder_id' in several queries below.
1033+
$folder_sql = ($folder_id != PRIVMSGS_UNREADBOX) ? "AND folder_id = $folder_id" : '';
9851034

9861035
if (!$user_id)
9871036
{
@@ -1006,7 +1055,7 @@ function delete_pm($user_id, $msg_ids, $folder_id)
10061055
$sql = 'SELECT msg_id, pm_unread, pm_new
10071056
FROM ' . PRIVMSGS_TO_TABLE . '
10081057
WHERE ' . $db->sql_in_set('msg_id', array_map('intval', $msg_ids)) . "
1009-
AND folder_id = $folder_id
1058+
$folder_sql
10101059
AND user_id = $user_id";
10111060
$result = $db->sql_query($sql);
10121061

@@ -1058,7 +1107,7 @@ function delete_pm($user_id, $msg_ids, $folder_id)
10581107
// Delete private message data
10591108
$sql = 'DELETE FROM ' . PRIVMSGS_TO_TABLE . "
10601109
WHERE user_id = $user_id
1061-
AND folder_id = $folder_id
1110+
$folder_sql
10621111
AND " . $db->sql_in_set('msg_id', array_keys($delete_rows));
10631112
$db->sql_query($sql);
10641113
$num_deleted = $db->sql_affectedrows();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,300 @@
1+
<?php
2+
/**
3+
*
4+
* functions_view_or_mark_unread_posts.php
5+
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
6+
*
7+
*/
8+
9+
/**
10+
* @ignore
11+
*/
12+
if (!defined('IN_PHPBB'))
13+
{
14+
exit;
15+
}
16+
17+
18+
/**
19+
* checks to see if the user has any unread posts in the forum
20+
* (returns true if there are unread posts and false if there are not)
21+
*/
22+
function check_unread_posts()
23+
{
24+
global $db, $user, $auth, $exists_unreads;
25+
26+
// The next block of code skips the check if the user is a guest (since prosilver and subsilver hide the unread link from guests)
27+
// or if the user is a a bot. If you use a template that shows the link to unread posts for guests, you may want to get rid of the first part of the if
28+
// clause so that the text of the link to unread posts will toggle rather than always reading 'View unread posts'.
29+
if (($user->data['user_id'] == ANONYMOUS) || $user->data['is_bot'])
30+
{
31+
return true;
32+
}
33+
34+
// if the user is on the index and functions_display has already checked for unreads, we skip unnecessary queries and return true or false
35+
if ($exists_unreads == 1)
36+
{
37+
return true;
38+
}
39+
if ($exists_unreads == -1)
40+
{
41+
return false;
42+
}
43+
44+
// user not on index so we need to check whether there are unreads
45+
46+
// find forums where last post time is greater than the forum's mark time (or, if there is none, the user's lastmark time)
47+
$sql = 'SELECT f.forum_id
48+
FROM ' . FORUMS_TABLE . ' f
49+
LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft
50+
ON (f.forum_id = ft.forum_id AND ft.user_id = ' . $user->data['user_id'] . ')
51+
WHERE f.forum_last_post_time > ft.mark_time
52+
OR (ft.mark_time IS NULL AND f.forum_last_post_time > ' . $user->data['user_lastmark'] . ')';
53+
$result = $db->sql_query($sql);
54+
55+
// cycle through the results and return true if we hit one the user is authorized to read
56+
while($row = $db->sql_fetchrow($result))
57+
{
58+
if ($auth->acl_get('f_read', $row['forum_id']))
59+
{
60+
return true;
61+
}
62+
}
63+
$db->sql_freeresult($result);
64+
65+
// last step: check to see if any global topics are unread, since the preceding test only checks regular forums
66+
// (this code is copied from the test for global unreads that appears in display_forums()
67+
$unread_ga_list = get_unread_topics($user->data['user_id'], 'AND t.forum_id = 0', '', 1);
68+
if (!empty($unread_ga_list))
69+
{
70+
return true;
71+
}
72+
73+
// user has no unreads, so return false
74+
return false;
75+
}
76+
77+
78+
/**
79+
* marks a private message unread when the user clicks the mark pm as unread link
80+
* when viewing the private message. Takes a single parameter, which is the msg_id of the pm
81+
* being marked as unread
82+
*/
83+
function mark_unread_pm($msg_id)
84+
{
85+
global $db, $user, $phpbb_root_path, $phpEx;
86+
87+
// redirect the user to the index if the user is not logged in or if user is a bot
88+
if (($user->data['user_id'] == ANONYMOUS) || $user->data['is_bot'])
89+
{
90+
redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
91+
}
92+
93+
$user->setup('ucp');
94+
95+
// find out what folder we are talking about so we can confine our actions to that folder
96+
$folder_id = request_var('f', PRIVMSGS_INBOX);
97+
98+
$sql = 'SELECT msg_id
99+
FROM ' . PRIVMSGS_TO_TABLE . '
100+
WHERE msg_id = ' . $msg_id . '
101+
AND user_id = ' . $user->data['user_id'] . '
102+
AND pm_deleted = 0
103+
AND folder_id =' . $folder_id;
104+
$result = $db->sql_query($sql);
105+
106+
if ($row = $db->sql_fetchrow($result))
107+
{
108+
// there is a pm in the relevant mailbox that matches that msg_id
109+
// so go ahead and mark it unread
110+
$sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . '
111+
SET pm_unread = 1
112+
WHERE msg_id = ' . $msg_id . '
113+
AND user_id = ' . $user->data['user_id'] . '
114+
AND pm_deleted = 0
115+
AND folder_id =' . $folder_id;
116+
$db->sql_query($sql);
117+
include($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx);
118+
update_pm_counts();
119+
}
120+
else
121+
{
122+
// if we get here, there is no pm in this user's inbox that matches that msg_id
123+
trigger_error('NO_MESSAGE');
124+
}
125+
$db->sql_freeresult($result);
126+
127+
$meta_info = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&amp;folder=inbox');
128+
meta_refresh(3, $meta_info);
129+
$message = $user->lang['PM_MARKED_UNREAD'] . '<br /><br />';
130+
$message .= '<a href="' . $meta_info . '">' . $user->lang['RETURN_INBOX'] . '</a><br /><br />';
131+
$message .= sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a>');
132+
trigger_error($message);
133+
}
134+
135+
136+
/**
137+
* marks a post unread when the user clicks the mark post as unread link for the
138+
* post in viewtopic. Takes two parameters: the post_id of the post
139+
* being marked as unread and the forum from which the user comes. Note that
140+
* if the post is a global the forum from which the user comes will not be the
141+
* the forum_id for the post (since the forum_id for the post will in that case be 0).
142+
143+
*/
144+
function mark_unread_post($unread_post_id, $return_forum_id)
145+
{
146+
global $db, $config, $user, $auth, $phpbb_root_path, $phpEx;
147+
148+
// redirect the user to the index if the user is not logged in or the board is set up
149+
// to use cookies rather than the database to store read topic info (since this mod is
150+
// set up to work only with logged in users and not with cookies); also redirect
151+
// to index if the user is a bot
152+
if (($user->data['user_id'] == ANONYMOUS) || !$config['load_db_lastread'] || $user->data['is_bot'])
153+
{
154+
redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
155+
}
156+
157+
$user->setup('viewtopic');
158+
// fetch the post_time, topic_id and forum_id of the post being marked as unread
159+
$sql = 'SELECT post_time, topic_id, forum_id
160+
FROM ' . POSTS_TABLE . '
161+
WHERE post_id = ' . $unread_post_id;
162+
$result = $db->sql_query($sql);
163+
if ($row = $db->sql_fetchrow($result))
164+
{
165+
$post_time = $row['post_time'];
166+
$mark_time = $post_time - 1;
167+
$topic_id = $row['topic_id'];
168+
$forum_id = $row['forum_id'];
169+
}
170+
else
171+
{
172+
// if we get here, post didn't exist so give an error
173+
trigger_error('NO_TOPIC');
174+
}
175+
$db->sql_freeresult($result);
176+
177+
// trigger an error if (a) topic does not exist or (b) user is not allowed to read it
178+
if (!$topic_id || (!$auth->acl_get('f_read', $return_forum_id)))
179+
{
180+
trigger_error('NO_TOPIC');
181+
}
182+
183+
// set mark_time for the user and the relevant topic in the topics_track table
184+
// to the post_time of the post minus 1 (so that phpbb3 will think the post is unread)
185+
markread('topic', $forum_id, $topic_id, $mark_time, $user->data['user_id']);
186+
187+
// now, tinker with the forums_track and topics_track tables in accordance with these rules:
188+
//
189+
// - set $forum_tracking_info to be the mark_time entry for the user and relevant forum in the forum_tracks table;
190+
// if there is no such entry, set $forum_tracking_info to be the user_lastmark entry for the user in the users table
191+
//
192+
// - if the post_time of the post is smaller (earlier) than $forum_tracking_info, then:
193+
//
194+
// - set mark_time for the user and the relevant forum in the forums_track table
195+
// to the post_time for the post minus 1 (so that phpbb3 will think the forum is unread)
196+
//
197+
// - but before doing that, add a new topics_track entry
198+
// (with mark_time = forum_tracking_info before the new mark_time entry is added to the forums_track table)
199+
// for each other topic in the forum that meets all of the following tests
200+
//
201+
// - does not already have a topics_track entry for the user and forum
202+
//
203+
// - has a topic_last_post_time less than or equal to the then current forum_tracking_info
204+
// (which shows that it has already been read)
205+
//
206+
// - has a last post time greater than the new mark_time that will be used for the forums_track table
207+
//
208+
// The purpose of adding these new topics_track entries is to make sure that phpbb3
209+
// will continue to treat already read topics as already read rather than incorrectly
210+
// thinking they are unread because their topic_last_post_time is after the new
211+
// mark_time for the relevant forum
212+
213+
214+
// so the first step: calculate the forum_tracking_info
215+
$sql = 'SELECT mark_time
216+
FROM ' . FORUMS_TRACK_TABLE . '
217+
WHERE forum_id = ' . $forum_id . '
218+
AND user_id = ' . $user->data['user_id'];
219+
$result = $db->sql_query($sql);
220+
$row = $db->sql_fetchrow($result);
221+
$db->sql_freeresult($result);
222+
223+
$forum_tracking_info = (!empty($row['mark_time'])) ? $row['mark_time'] : $user->data['user_lastmark'];
224+
225+
// next, check to see if the post being marked unread has a post_time at or before $forum_tracking_info
226+
if ($post_time <= $forum_tracking_info)
227+
{
228+
// ok, post being marked unread has post time at or before $forum_tracking_info, so we will
229+
// need to create special topics_track entries for all topics that
230+
// meet the three tests described in the comment that appears before the $sql definition above
231+
// (since these are the topics that are currently considered 'read' and would otherwise
232+
// no longer be considered read when we change the forums_track entry to an earlier mark_time
233+
// later in the script)
234+
235+
// so, fetch the topic_ids and related info for the topics in this forum that meet the three tests
236+
$sql = 'SELECT t.topic_id, t.topic_last_post_time, tt.mark_time
237+
FROM ' . TOPICS_TABLE . ' t
238+
LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt ON (t.topic_id = tt.topic_id AND tt.user_id = ' . $user->data['user_id'] . ')
239+
WHERE tt.mark_time IS NULL
240+
AND t.forum_id = ' . $forum_id . '
241+
AND t.topic_last_post_time <= ' . $forum_tracking_info . '
242+
AND t.topic_last_post_time > ' . $mark_time;
243+
$result = $db->sql_query($sql);
244+
$sql_insert_ary = array();
245+
246+
// for each of the topics meeting the three tests, create a topics_track entry
247+
while($row = $db->sql_fetchrow($result))
248+
{
249+
$sql_insert_ary[] = array(
250+
'user_id' => $user->data['user_id'],
251+
'topic_id' => $row['topic_id'],
252+
'forum_id' => $forum_id,
253+
'mark_time' => $forum_tracking_info,
254+
);
255+
}
256+
$db->sql_multi_insert(TOPICS_TRACK_TABLE, $sql_insert_ary);
257+
$db->sql_freeresult($result);
258+
259+
// finally, move the forums_track time back to $mark_time by inserting or updating the relevant row;
260+
// to do that, find out if there already is an entry for this user_id and forum_id
261+
$sql = 'SELECT forum_id
262+
FROM ' . FORUMS_TRACK_TABLE . '
263+
WHERE forum_id = ' . $forum_id . '
264+
AND user_id = ' . $user->data['user_id'];
265+
$result = $db->sql_query($sql);
266+
$row = $db->sql_fetchrow($result);
267+
$db->sql_freeresult($result);
268+
269+
if (isset($row['forum_id']))
270+
{
271+
// in this case there is already an entry for this user and forum_id
272+
// in the forums_track table, so update the entry for the forum_id
273+
$sql = 'UPDATE ' . FORUMS_TRACK_TABLE . '
274+
SET mark_time = ' . $mark_time . '
275+
WHERE forum_id = ' . $forum_id . '
276+
AND user_id = ' . $user->data['user_id'];
277+
$db->sql_query($sql);
278+
}
279+
else
280+
{
281+
// in this case there is no entry for this user and forum_id
282+
// in the forums_track table, so insert one
283+
$sql = 'INSERT INTO ' . FORUMS_TRACK_TABLE . ' ' . $db->sql_build_array('INSERT', array(
284+
'user_id' => $user->data['user_id'],
285+
'forum_id' => $forum_id,
286+
'mark_time' => $mark_time,
287+
));
288+
$db->sql_query($sql);
289+
}
290+
}
291+
292+
$meta_info = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $return_forum_id);
293+
meta_refresh(3, $meta_info);
294+
$message = $user->lang['POST_MARKED_UNREAD'] . '<br /><br />';
295+
$message .= sprintf($user->lang['RETURN_FORUM'], '<a href="' . $meta_info . '">', '</a>') . '<br /><br />';
296+
$message .= sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a>');
297+
trigger_error($message);
298+
}
299+
300+
?>

‎includes/ucp/ucp_pm.php

+17-4
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,23 @@ function main($id, $mode)
6262
// Folder directly specified?
6363
$folder_specified = request_var('folder', '');
6464

65-
if (!in_array($folder_specified, array('inbox', 'outbox', 'sentbox')))
65+
// start mod view or mark unread posts
66+
$msg_id = request_var('mu', 0);
67+
if ($msg_id)
68+
{
69+
mark_unread_pm($msg_id);
70+
}
71+
72+
// the block below is in regular phpbb3 but I added refences to unreadbox
73+
if (!in_array($folder_specified, array('inbox', 'outbox', 'unreadbox', 'sentbox')))
6674
{
6775
$folder_specified = (int) $folder_specified;
6876
}
6977
else
7078
{
71-
$folder_specified = ($folder_specified == 'inbox') ? PRIVMSGS_INBOX : (($folder_specified == 'outbox') ? PRIVMSGS_OUTBOX : PRIVMSGS_SENTBOX);
79+
$folder_specified = ($folder_specified == 'inbox') ? PRIVMSGS_INBOX : (($folder_specified == 'outbox') ? PRIVMSGS_OUTBOX : (($folder_specified == 'unreadbox') ? PRIVMSGS_UNREADBOX : PRIVMSGS_SENTBOX));
7280
}
81+
// end mod view or mark unread posts
7382

7483
if (!$folder_specified)
7584
{
@@ -208,7 +217,8 @@ function main($id, $mode)
208217
$dest_folder = request_var('dest_folder', PRIVMSGS_NO_BOX);
209218

210219
// Is moving PM triggered through mark options?
211-
if (!in_array($mark_option, array('mark_important', 'delete_marked')) && $submit_mark)
220+
// start mod view or mark unread posts (and end mod too)...added mark_marked_read and mark_marked_unread options to next line
221+
if (!in_array($mark_option, array('mark_important', 'mark_marked_read', 'mark_marked_unread', 'delete_marked')) && $submit_mark)
212222
{
213223
$move_pm = true;
214224
$dest_folder = (int) $mark_option;
@@ -331,7 +341,8 @@ function main($id, $mode)
331341
{
332342
$option = '<option' . ((!in_array($f_id, array(PRIVMSGS_INBOX, PRIVMSGS_OUTBOX, PRIVMSGS_SENTBOX))) ? ' class="sep"' : '') . ' value="' . $f_id . '"' . (($f_id == $folder_id) ? ' selected="selected"' : '') . '>' . $folder_ary['folder_name'] . (($folder_ary['unread_messages']) ? ' [' . $folder_ary['unread_messages'] . '] ' : '') . '</option>';
333343

334-
$s_to_folder_options .= ($f_id != PRIVMSGS_OUTBOX && $f_id != PRIVMSGS_SENTBOX) ? $option : '';
344+
// start mod view or mark unread posts (and end mod too)...added reference to unreadbox in next line to supress move to unread box entry in dropdown menu
345+
$s_to_folder_options .= ($f_id != PRIVMSGS_OUTBOX && $f_id != PRIVMSGS_SENTBOX && $f_id != PRIVMSGS_UNREADBOX) ? $option : '';
335346
$s_folder_options .= $option;
336347
}
337348
clean_sentbox($folder[PRIVMSGS_SENTBOX]['num_messages']);
@@ -354,6 +365,8 @@ function main($id, $mode)
354365
'S_PM_ACTION' => $this->u_action . '&amp;action=' . $action,
355366

356367
'U_INBOX' => $this->u_action . '&amp;folder=inbox',
368+
'U_MARK_UNREAD' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&amp;f=' . $folder_id . '&amp;mu=' . $msg_id),
369+
// start mod view or mark unread posts (and end mod too)...added the preceding line about marking unread pms
357370
'U_OUTBOX' => $this->u_action . '&amp;folder=outbox',
358371
'U_SENTBOX' => $this->u_action . '&amp;folder=sentbox',
359372
'U_CREATE_FOLDER' => $this->u_action . '&amp;mode=options',

‎includes/ucp/ucp_pm_viewfolder.php

+9-4
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ function view_folder($id, $mode, $folder_id, $folder)
6363
);
6464
}
6565

66-
$mark_options = array('mark_important', 'delete_marked');
66+
// start mod view or mark unread posts (and end mod too)...added mark_marked_read and mark_marked_unread options to next line
67+
$mark_options = array('mark_important', 'mark_marked_read', 'mark_marked_unread', 'delete_marked');
6768

6869
// Minimise edits
6970
if (!$auth->acl_get('u_pm_delete') && $key = array_search('delete_marked', $mark_options))
@@ -83,7 +84,8 @@ function view_folder($id, $mode, $folder_id, $folder)
8384
{
8485
foreach ($folder as $f_id => $folder_ary)
8586
{
86-
if ($f_id == PRIVMSGS_OUTBOX || $f_id == PRIVMSGS_SENTBOX || $f_id == $folder_id)
87+
// start mod view or mark unread posts (and end mod too)...added reference to unreadbox in next line to supress move to unread box entry in dropdown menu
88+
if ($f_id == PRIVMSGS_OUTBOX || $f_id == PRIVMSGS_SENTBOX || $f_id == $folder_id || $f_id == PRIVMSGS_UNREADBOX)
8789
{
8890
continue;
8991
}
@@ -132,7 +134,9 @@ function view_folder($id, $mode, $folder_id, $folder)
132134
$folder_alt = ($row['pm_unread']) ? 'NEW_MESSAGES' : 'NO_NEW_MESSAGES';
133135

134136
// Generate all URIs ...
135-
$view_message_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=$id&amp;mode=view&amp;f=$folder_id&amp;p=$message_id");
137+
$view_message_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=$id&amp;mode=view&amp;f=" . $row['folder_id'] . "&amp;p=$message_id");
138+
// start mod view or mark unread posts (and end mod too)...changed $folder_id to $row['folder_id']
139+
// since items in the 'unread box' actually come from different folders
136140
$remove_message_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=$id&amp;mode=compose&amp;action=delete&amp;p=$message_id");
137141

138142
$row_indicator = '';
@@ -422,7 +426,8 @@ function get_pm_from($folder_id, $folder, $user_id)
422426
$s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
423427
gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param);
424428

425-
$folder_sql = 't.folder_id = ' . (int) $folder_id;
429+
// start mod view or mark unread posts (and end mod too)...added test for unreads in next line
430+
$folder_sql = ($folder_id == PRIVMSGS_UNREADBOX) ? '((t.pm_new = 1 OR t.pm_unread = 1) AND t.folder_id != ' . PRIVMSGS_HOLD_BOX . ')' : 't.folder_id = ' . (int) $folder_id;
426431

427432
// Limit pms to certain time frame, obtain correct pm count
428433
if ($sort_days)

‎language/en/common.php

+12
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,18 @@
746746
'YOU_NEW_PMS' => 'New private messages are waiting for you in your Inbox.',
747747
'YOU_NO_NEW_PM' => 'No new private messages are waiting for you.',
748748

749+
// start mod view or mark unread posts
750+
'LOGIN_EXPLAIN_VIEWUNREADS' => 'You must be logged in to view your unread post list',
751+
'MARK_MARKED_READ' => 'Mark marked as read',
752+
'MARK_MARKED_UNREAD' => 'Mark marked as unread',
753+
'MARK_PM_UNREAD' => 'Mark pm as unread',
754+
'MARK_POST_UNREAD' => 'Mark post as unread',
755+
'NO_UNREADS' => 'You have no unread posts',
756+
'PM_MARKED_UNREAD' => 'Private message marked as unread',
757+
'POST_MARKED_UNREAD' => 'Post marked as unread',
758+
'RETURN_INBOX' => 'Return to pm inbox',
759+
'VIEW_UNREAD_PMS' => 'View unread pms',
760+
// end mod view or mark unread posts
749761
'datetime' => array(
750762
'TODAY' => 'Today',
751763
'TOMORROW' => 'Tomorrow',

‎search.php

+5
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,11 @@
396396

397397
case 'unreadposts':
398398
$l_search_title = $user->lang['SEARCH_UNREAD'];
399+
// start mod view or mark unread posts
400+
$template->assign_vars(array(
401+
'U_MARK_FORUMS' => append_sid("{$phpbb_root_path}index.$phpEx", 'hash=' . generate_link_hash('global') . '&amp;mark=forums'),
402+
'S_SHOW_MARK_FORUMS_LINK' => true));
403+
// end mod view or mark unread posts
399404
// force sorting
400405
$show_results = 'topics';
401406
$sort_key = 't';

‎styles/acidtech/template/overall_header.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,8 @@
351351
</td>
352352
<td class="gensmall" align="{S_CONTENT_FLOW_END}">
353353
{CURRENT_TIME}<br />
354-
<!-- IF S_DISPLAY_SEARCH and S_USER_LOGGED_IN --><a href="{U_SEARCH_UNREAD}">{L_SEARCH_UNREAD}</a> | <a href="{U_SEARCH_NEW}">{L_SEARCH_NEW}</a> | <a href="{U_SEARCH_SELF}">{L_SEARCH_SELF}</a><!-- ENDIF -->
354+
<!-- IF S_DISPLAY_SEARCH and S_USER_LOGGED_IN --><!-- IF S_EXISTS_UNREADS --><a href="{U_SEARCH_UNREAD}">{L_SEARCH_UNREAD}</a><!-- ELSE --><a href="{U_SEARCH_UNREAD}">{L_NO_UNREADS}</a><!-- ENDIF --> | <a href="{U_SEARCH_NEW}">{L_SEARCH_NEW}</a> | <a href="{U_SEARCH_SELF}">{L_SEARCH_SELF}</a><!-- ENDIF -->
355+
<!-- start mod view or mark unread posts (and end mod too) ... added code in preceding line to toggle link text between view unread and no unreads -->
355356
</td>
356357
</tr>
357358
</table>

‎styles/acidtech/template/search_results.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<table width="100%" cellspacing="1">
66
<tr>
7-
<td colspan="2"><span class="titles"><!-- IF SEARCH_TITLE -->{SEARCH_TITLE}<!-- ELSE -->{SEARCH_MATCHES}<!-- ENDIF --></span><br /></td>
7+
<td colspan="2"><span class="titles"><!-- IF SEARCH_TITLE -->{SEARCH_TITLE}<!-- ELSE -->{SEARCH_MATCHES}<!-- ENDIF --></span><br /><!-- IF S_SHOW_MARK_FORUMS_LINK --><p class="gensmall"><a href="{U_MARK_FORUMS}">{L_MARK_FORUMS_READ}</a></p><br /><!-- ENDIF --></td>
88
</tr>
99
<tr>
1010
<td class="genmed"><!-- IF SEARCH_TOPIC -->{L_SEARCHED_TOPIC}: <a href="{U_SEARCH_TOPIC}"><b>{SEARCH_TOPIC}</b></a><br /><!-- ENDIF --><!-- IF SEARCH_WORDS -->{L_SEARCHED_FOR}: <a href="{U_SEARCH_WORDS}"><b>{SEARCH_WORDS}</b></a><!-- ENDIF --><!-- IF IGNORED_WORDS --> {L_IGNORED_TERMS}: <b>{IGNORED_WORDS}</b><!-- ENDIF --></td>

‎styles/acidtech/template/ucp_pm_viewmessage.html

+5
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@
8484

8585
<!-- IF not S_HAS_ATTACHMENTS --><br clear="all" /><br /><!-- ENDIF -->
8686

87+
<div style="float: {S_CONTENT_FLOW_END}">
88+
<a href="{U_MARK_UNREAD}" class="gensmall" title="{L_MARK_PM_UNREAD}">{L_MARK_PM_UNREAD}</a>
89+
<!-- start mod view or mark unread posts (and end mod too) ... added preceding line -->
90+
</div>
91+
8792
</td>
8893
</tr>
8994
</table>

‎styles/acidtech/template/viewtopic_body.html

+3
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,9 @@ <h2><a class="titles" href="{U_VIEW_TOPIC}">{TOPIC_TITLE}</a></h2>
217217
<span class="gensmall"><br /><br />{postrow.BUMPED_MESSAGE}</span>
218218
<!-- ENDIF -->
219219

220+
<!-- IF S_INC_UNREAD_LINK --><div style="float: {S_CONTENT_FLOW_END}"><a href="{postrow.U_MARK_UNREAD}" class="gensmall" title="{L_MARK_POST_UNREAD}">{L_MARK_POST_UNREAD}</a></div><!-- ENDIF -->
221+
<!-- start mod view or mark unread posts (and end mod too) ... added mark_post_unread references in the preceding line -->
222+
220223
<!-- IF not postrow.S_HAS_ATTACHMENTS --><br clear="all" /><br /><!-- ENDIF -->
221224
</td>
222225
</tr>

‎styles/prosilver/template/index_body.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
<!-- IF S_DISPLAY_SEARCH or (S_USER_LOGGED_IN and not S_IS_BOT) -->
77
<ul class="linklist">
88
<!-- IF S_DISPLAY_SEARCH -->
9-
<li><a href="{U_SEARCH_UNANSWERED}">{L_SEARCH_UNANSWERED}</a><!-- IF S_LOAD_UNREADS --> &bull; <a href="{U_SEARCH_UNREAD}">{L_SEARCH_UNREAD}</a><!-- ENDIF --><!-- IF S_USER_LOGGED_IN --> &bull; <a href="{U_SEARCH_NEW}">{L_SEARCH_NEW}</a><!-- ENDIF --> &bull; <a href="{U_SEARCH_ACTIVE_TOPICS}">{L_SEARCH_ACTIVE_TOPICS}</a></li>
9+
<li><a href="{U_SEARCH_UNANSWERED}">{L_SEARCH_UNANSWERED}</a><!-- IF S_LOAD_UNREADS --> &bull; <!-- IF S_EXISTS_UNREADS --><a href="{U_SEARCH_UNREAD}">{L_SEARCH_UNREAD}</a><!-- ELSE --><a href="{U_SEARCH_UNREAD}">{L_NO_UNREADS}</a><!-- ENDIF --><!-- ENDIF --><!-- IF S_USER_LOGGED_IN --> &bull; <a href="{U_SEARCH_NEW}">{L_SEARCH_NEW}</a><!-- ENDIF --> &bull; <a href="{U_SEARCH_ACTIVE_TOPICS}">{L_SEARCH_ACTIVE_TOPICS}</a></li>
10+
<!-- start mod view or mark unread posts (and end mod too) ... added code in preceding line to toggle link text between view unread and no unreads -->
1011
<!-- ENDIF -->
1112
<!-- IF not S_IS_BOT and U_MARK_FORUMS --><li class="rightside"><a href="{U_MARK_FORUMS}" accesskey="m">{L_MARK_FORUMS_READ}</a></li><!-- ENDIF -->
1213
</ul>

‎styles/prosilver/template/search_results.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ <h2><!-- IF SEARCH_TITLE -->{SEARCH_TITLE}<!-- ELSE -->{SEARCH_MATCHES}<!-- ENDI
77
<!-- IF SEARCH_TOPIC -->
88
<p><a class="{S_CONTENT_FLOW_BEGIN}" href="{U_SEARCH_TOPIC}">{L_RETURN_TO}: {SEARCH_TOPIC}</a></p>
99
<!-- ELSE -->
10-
<p><a class="{S_CONTENT_FLOW_BEGIN}" href="{U_SEARCH}" title="{L_SEARCH_ADV}">{L_RETURN_TO_SEARCH_ADV}</a></p>
10+
<p><a class="{S_CONTENT_FLOW_BEGIN}" href="{U_SEARCH}" title="{L_SEARCH_ADV}">{L_RETURN_TO_SEARCH_ADV}</a><!-- IF S_SHOW_MARK_FORUMS_LINK --><br /><a class="{S_CONTENT_FLOW_BEGIN}" href="{U_MARK_FORUMS}" title="{L_MARK_FORUMS_READ}">{L_MARK_FORUMS_READ}</a><!-- ENDIF --></p>
1111
<!-- ENDIF -->
1212

1313
<!-- IF PAGINATION or SEARCH_MATCHES or PAGE_NUMBER -->

‎styles/prosilver/template/ucp_pm_viewmessage.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ <h3 class="first">{SUBJECT}</h3>
9090
<!-- ENDIF -->
9191
</dl>
9292

93-
<div class="back2top"><a href="#top" class="top" title="{L_BACK_TO_TOP}">{L_BACK_TO_TOP}</a></div>
93+
<div class="back2top"><a href="#top" class="top" title="{L_BACK_TO_TOP}">{L_BACK_TO_TOP}</a><a href="{U_MARK_UNREAD}" class="post" title="{L_MARK_PM_UNREAD}">{L_MARK_PM_UNREAD}</a></div>
94+
<!-- start mod view or mark unread posts (and end mod too) ... added mark_pm_unread references in the preceding line -->
9495

9596
<span class="corners-bottom"><span></span></span></div>
9697
</div>

‎styles/prosilver/template/viewtopic_body.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,8 @@ <h3 <!-- IF postrow.S_FIRST_ROW -->class="first"<!-- ENDIF -->><!-- IF postrow.P
214214
</dl>
215215
<!-- ENDIF -->
216216

217-
<div class="back2top"><a href="#wrap" class="top" title="{L_BACK_TO_TOP}">{L_BACK_TO_TOP}</a></div>
217+
<div class="back2top"><a href="#wrap" class="top" title="{L_BACK_TO_TOP}">{L_BACK_TO_TOP}</a><!-- IF S_INC_UNREAD_LINK --><a href="{postrow.U_MARK_UNREAD}" class="post" title="{L_MARK_POST_UNREAD}">{L_MARK_POST_UNREAD}</a><!-- ENDIF --></div>
218+
<!-- start mod view or mark unread posts (and end mod too) ... added preceding line -->
218219

219220
<span class="corners-bottom"><span></span></span></div>
220221
</div>

‎styles/subsilver2/template/overall_header.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,8 @@
319319
<p class="searchbar">
320320
<span style="float: {S_CONTENT_FLOW_BEGIN};"><a href="{U_SEARCH_UNANSWERED}">{L_SEARCH_UNANSWERED}</a> | <a href="{U_SEARCH_ACTIVE_TOPICS}">{L_SEARCH_ACTIVE_TOPICS}</a></span>
321321
<!-- IF S_USER_LOGGED_IN or S_LOAD_UNREADS -->
322-
<span style="float: {S_CONTENT_FLOW_END};"><!-- IF S_LOAD_UNREADS --><a href="{U_SEARCH_UNREAD}">{L_SEARCH_UNREAD}</a><!-- IF S_USER_LOGGED_IN --> | <!-- ENDIF --><!-- ENDIF --><!-- IF S_USER_LOGGED_IN --><a href="{U_SEARCH_NEW}">{L_SEARCH_NEW}</a> | <a href="{U_SEARCH_SELF}">{L_SEARCH_SELF}</a><!-- ENDIF --></span>
322+
<span style="float: {S_CONTENT_FLOW_END};"><!-- IF S_LOAD_UNREADS --><!-- IF S_EXISTS_UNREADS --><a href="{U_SEARCH_UNREAD}">{L_SEARCH_UNREAD}</a><!-- ELSE --><a href="{U_SEARCH_UNREAD}">{L_NO_UNREADS}</a><!-- ENDIF --><!-- IF S_USER_LOGGED_IN --> | <!-- ENDIF --><!-- ENDIF --><!-- IF S_USER_LOGGED_IN --><a href="{U_SEARCH_NEW}">{L_SEARCH_NEW}</a> | <a href="{U_SEARCH_SELF}">{L_SEARCH_SELF}</a><!-- ENDIF --></span>
323+
<!-- start mod view or mark unread posts (and end mod too) ... added code in preceding line to toggle link text between view unread and no unreads -->
323324
<!-- ENDIF -->
324325
</p>
325326
<!-- ENDIF -->

‎styles/subsilver2/template/search_results.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<table width="100%" cellspacing="1">
66
<tr>
7-
<td colspan="2"><span class="titles"><!-- IF SEARCH_TITLE -->{SEARCH_TITLE}<!-- ELSE -->{SEARCH_MATCHES}<!-- ENDIF --></span><br /></td>
7+
<td colspan="2"><span class="titles"><!-- IF SEARCH_TITLE -->{SEARCH_TITLE}<!-- ELSE -->{SEARCH_MATCHES}<!-- ENDIF --></span><br /><!-- IF S_SHOW_MARK_FORUMS_LINK --><p class="gensmall"><a href="{U_MARK_FORUMS}">{L_MARK_FORUMS_READ}</a></p><br /><!-- ENDIF --></td>
88
</tr>
99
<tr>
1010
<td class="genmed"><!-- IF SEARCH_TOPIC -->{L_SEARCHED_TOPIC}: <a href="{U_SEARCH_TOPIC}"><b>{SEARCH_TOPIC}</b></a><br /><!-- ENDIF --><!-- IF SEARCH_WORDS -->{L_SEARCHED_FOR}: <a href="{U_SEARCH_WORDS}"><b>{SEARCH_WORDS}</b></a><!-- ENDIF --><!-- IF IGNORED_WORDS --> {L_IGNORED_TERMS}: <b>{IGNORED_WORDS}</b><!-- ENDIF --></td>

‎styles/subsilver2/template/ucp_pm_viewmessage.html

+2
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@
100100

101101
<table width="100%" cellspacing="0">
102102
<tr valign="middle">
103+
<td valign="bottom"><a href="{U_MARK_UNREAD}" class="gensmall" title="{L_MARK_PM_UNREAD}">{L_MARK_PM_UNREAD}</a></td>
104+
<!-- start mod view or mark unread posts (and end mod too) ... added preceding line -->
103105
<td class="gensmall" align="{S_CONTENT_FLOW_END}"> <!-- IF U_REPORT --><a href="{U_REPORT}">{REPORT_IMG}</a> <!-- ENDIF --><!-- IF U_DELETE --><a href="{U_DELETE}">{DELETE_IMG}</a> <!-- ENDIF --></td>
104106
</tr>
105107
</table>

‎styles/subsilver2/template/viewtopic_body.html

+2
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,8 @@ <h2><a class="titles" href="{U_VIEW_TOPIC}">{TOPIC_TITLE}</a></h2>
268268

269269
<table width="100%" cellspacing="0">
270270
<tr valign="middle">
271+
<!-- IF S_INC_UNREAD_LINK --><td valign="bottom"><a href="{postrow.U_MARK_UNREAD}" class="gensmall" title="{L_MARK_POST_UNREAD}">{L_MARK_POST_UNREAD}</a></td><!-- ENDIF -->
272+
<!-- start mod view or mark unread posts (and end mod too) ... added mark_post_unread references in the preceding line -->
271273
<td class="gensmall" align="{S_CONTENT_FLOW_END}">
272274
<!-- IF not S_IS_BOT -->
273275
<!-- IF postrow.U_REPORT --><a href="{postrow.U_REPORT}">{REPORT_IMG}</a> <!-- ENDIF -->

‎viewtopic.php

+13
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@
4949
* @todo normalize?
5050
*/
5151
$hilit_words = request_var('hilit', '', true);
52+
// start mod view or mark unread posts
53+
$unread_post_id = request_var('mu', 0);
54+
if ($unread_post_id)
55+
{
56+
mark_unread_post($unread_post_id, $forum_id);
57+
}
58+
// end mod view or mark unread posts
5259

5360
// Do we have a topic or post id?
5461
if (!$topic_id && !$post_id)
@@ -673,6 +680,9 @@
673680
'S_DISPLAY_POST_INFO' => ($topic_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS)) ? true : false,
674681
'S_DISPLAY_REPLY_INFO' => ($topic_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_reply', $forum_id) || $user->data['user_id'] == ANONYMOUS)) ? true : false,
675682
'S_ENABLE_FEEDS_TOPIC' => ($config['feed_topic'] && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $topic_data['forum_options'])) ? true : false,
683+
// start mod view or mark unread posts - set flag that determines if user will see mark post unread links in the posts
684+
'S_INC_UNREAD_LINK' => ($config['load_db_lastread'] && $user->data['is_registered']) ? true : false,
685+
// end mod view or mark unread posts
676686

677687
'U_TOPIC' => "{$server_path}viewtopic.$phpEx?f=$forum_id&amp;t=$topic_id",
678688
'U_FORUM' => $server_path,
@@ -1591,6 +1601,9 @@
15911601
'U_QUOTE' => ($quote_allowed) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=quote&amp;f=$forum_id&amp;p={$row['post_id']}") : '',
15921602
'U_INFO' => ($auth->acl_get('m_info', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&amp;mode=post_details&amp;f=$forum_id&amp;p=" . $row['post_id'], true, $user->session_id) : '',
15931603
'U_DELETE' => ($delete_allowed) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=delete&amp;f=$forum_id&amp;p={$row['post_id']}") : '',
1604+
// start mod view or mark unread posts
1605+
'U_MARK_UNREAD' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'mu=' . $row['post_id'] . '&amp;f=' . $forum_id),
1606+
// end mod view or mark unread posts
15941607

15951608
'U_PROFILE' => $user_cache[$poster_id]['profile'],
15961609
'U_SEARCH' => $user_cache[$poster_id]['search'],

0 commit comments

Comments
 (0)
This repository has been archived.