This is a modification of phpBB 3.1.10 code (edit : also tested for 3.3.10) which add subscription/unsubscription buttons (ON/OFF style) on the right of forum list such as users can see directly their subscriptions. And by clicking on button, the status of subscription if toggled. Simple and clear:Original presentation about this MOD, and related comments/improvements, are there: https://www.phpbb.com/customise/db/mod/watch_forum_link_on_forum_list/support/topic/94167
Procedure
Please, make a copy of original phpBB files before editing…
Open: includes/functions_display.php
Find:
1 2 |
$forum_row = array( 'S_IS_CAT' => false, |
Add before:
1 2 3 4 5 6 7 8 |
$s_watching_forum = array( 'link' => '', 'link_toggle' => '', 'title' => '', 'title_toggle' => '', 'is_watching' => false, ); watch_topic_forum('forum', $s_watching_forum, $user->data['user_id'], $row['forum_id'], 0); |
Comment: this is to get watching status of current user in s_watching_forum array. I don’t know exactly if I use the watch_topic_forum function properly, but it seems to be OK…
And Add after: (on a new blank line)
1 2 3 |
'S_WATCHING_FORUM' => $s_watching_forum['is_watching'], 'S_WATCH_FORUM_LIST_LINK' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'uid=' . $user->data['user_id'] . '&f=' . $row['forum_id'] . '&watch=forum&hash=' . generate_link_hash('forum_' . $row['forum_id'])), 'S_UNWATCH_FORUM_LIST_LINK' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'uid=' . $user->data['user_id'] . '&f=' . $row['forum_id'] . '&unwatch=forum&hash=' . generate_link_hash('forum_' . $row['forum_id'])), |
Save the file.
Open: styles/prosilver/template/forumlist_body.html
Find:
1 2 3 4 5 6 |
<dd class="lastpost"><span> <!-- IF forumrow.U_UNAPPROVED_TOPICS --> <a href="{forumrow.U_UNAPPROVED_TOPICS}">{UNAPPROVED_IMG}</a> <!-- ELSEIF forumrow.U_UNAPPROVED_POSTS --> <a href="{forumrow.U_UNAPPROVED_POSTS}">{UNAPPROVED_POST_IMG}</a> <!-- ENDIF --> |
Add after:
1 2 3 4 5 6 7 |
<!-- IF not .forumrow.subforum or not forumrow.S_LIST_SUBFORUMS --> <!-- IF not forumrow.S_WATCHING_FORUM --> <!-- IF forumrow.S_WATCH_FORUM_LIST_LINK and not S_IS_BOT and not forumrow.S_IS_LINK --><a class="watch-icon-forum" href="{forumrow.S_WATCH_FORUM_LIST_LINK}"><img src="{T_THEME_PATH}/images/off-20.png" title="Actually, you are not watching this forum. Click here to SUBSCRIBE and so you will receive an e-mail if a new post is added here." /></a><!-- ENDIF --> <!-- ELSE --> <!-- IF forumrow.S_UNWATCH_FORUM_LIST_LINK and not S_IS_BOT and not forumrow.S_IS_LINK --><a class="watch-icon-forum" href="{forumrow.S_UNWATCH_FORUM_LIST_LINK}"><img src="{T_THEME_PATH}/images/on-20.png" title="Actually, you are watching this forum. Click here to UNSUBSCRIBE, and so you will no longer receive e-mails from this forum." /></a><!-- ENDIF --> <!-- ENDIF --> <!-- ENDIF --> |
Comments:
Translation in french for title elements above:
OFF: « Actuellement, vous n’êtes pas abonné(e) à ce forum. Cliquez ici pour vous ABONNER, ainsi vous recevrez un email lorsqu’un nouveau message sera posté dans ce forum. »
ON: « Vous êtes actuellement abonné(e) à ce forum. Cliquez ici pour vous DÉSABONNER et ne plus recevoir les emails de ce forum. »
Save the file.
File copy
Download icons.zip archive here:
and copy png files in your styles/prosilver/theme/images/ directory.
I give you 3 sets of icons:
– off.png, off-faded.png and on.png: red (OFF), faded red (OFF) and green (ON) buttons 126×54 px (big size, use it to make reductions as you like)
– off-30.png, off-faded-30.png and on-30.png: same but 70×30 px (medium size)
– off-20.png, off-faded-20.png and on-20.png: same but 47×20 px (small size, used in screen capture)
The faded red is only an alternative for esthetic reason, if you consider there is too much flashy red on you forum…
Final
Finally, clear cache via ACP, or by deleting all files in the /cache directory (except .htaccess and index.htm).