{"id":694,"date":"2017-04-24T21:00:09","date_gmt":"2017-04-24T19:00:09","guid":{"rendered":"http:\/\/darrigan.net\/blog\/?p=694"},"modified":"2023-09-30T14:54:33","modified_gmt":"2023-09-30T12:54:33","slug":"phpbb-mod-unsubscribed-button-forum-list","status":"publish","type":"post","link":"https:\/\/darrigan.net\/blog\/phpbb-mod-unsubscribed-button-forum-list\/","title":{"rendered":"phpBB : MOD (un)subscribed button on forum list"},"content":{"rendered":"<p>This is a modification of <strong>phpBB 3.1.10<\/strong> code <span style=\"color: #339966;\">(edit : also tested for <strong>3.3.10<\/strong>)<\/span> 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:<a href=\"http:\/\/darrigan.net\/blog\/wp-content\/uploads\/2017\/10\/boutons-on-off-phpbb.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-695\" src=\"http:\/\/darrigan.net\/blog\/wp-content\/uploads\/2017\/10\/boutons-on-off-phpbb.png\" alt=\"\" width=\"513\" height=\"184\" srcset=\"https:\/\/darrigan.net\/blog\/wp-content\/uploads\/2017\/10\/boutons-on-off-phpbb.png 513w, https:\/\/darrigan.net\/blog\/wp-content\/uploads\/2017\/10\/boutons-on-off-phpbb-300x108.png 300w\" sizes=\"(max-width: 513px) 100vw, 513px\" \/><\/a><!--more-->Original presentation about this MOD, and related comments\/improvements, are there: <a href=\"https:\/\/www.phpbb.com\/customise\/db\/mod\/watch_forum_link_on_forum_list\/support\/topic\/94167\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/www.phpbb.com\/customise\/db\/mod\/watch_forum_link_on_forum_list\/support\/topic\/94167<\/a><\/p>\n<h3>Procedure<\/h3>\n<p>Please, make a copy of original phpBB files before editing\u2026<\/p>\n<h4>Open: includes\/functions_display.php<\/h4>\n<p>Find:<\/p>\n<pre class=\"lang:php decode:true\">\t\t$forum_row = array(\r\n\t\t\t'S_IS_CAT'\t\t\t=&gt; false,<\/pre>\n<p>Add before:<\/p>\n<pre class=\"lang:php decode:true \">\t$s_watching_forum = array(\r\n\t\t'link'\t\t\t=&gt; '',\r\n\t\t'link_toggle'\t=&gt; '',\r\n\t\t'title'\t\t\t=&gt; '',\r\n\t\t'title_toggle'\t=&gt; '',\r\n\t\t'is_watching'\t=&gt; false,\r\n\t);\r\n\twatch_topic_forum('forum', $s_watching_forum, $user-&gt;data['user_id'], $row['forum_id'], 0);<\/pre>\n<p><em>Comment: this is to get watching status of current user in s_watching_forum array. I don&rsquo;t know exactly if I use the watch_topic_forum function properly, but it seems to be OK\u2026<\/em><\/p>\n<p>And Add after: (on a new blank line)<\/p>\n<pre class=\"lang:php decode:true \">\t'S_WATCHING_FORUM'\t\t=&gt; $s_watching_forum['is_watching'],\r\n\t'S_WATCH_FORUM_LIST_LINK'    =&gt; append_sid(\"{$phpbb_root_path}viewforum.$phpEx\", 'uid=' . $user-&gt;data['user_id'] . '&amp;amp;f=' . $row['forum_id'] . '&amp;amp;watch=forum&amp;amp;hash=' . generate_link_hash('forum_' . $row['forum_id'])),\r\n    'S_UNWATCH_FORUM_LIST_LINK'    =&gt; append_sid(\"{$phpbb_root_path}viewforum.$phpEx\", 'uid=' . $user-&gt;data['user_id'] . '&amp;amp;f=' . $row['forum_id'] . '&amp;amp;unwatch=forum&amp;amp;hash=' . generate_link_hash('forum_' . $row['forum_id'])),<\/pre>\n<p>Save the file.<\/p>\n<h4>Open: styles\/prosilver\/template\/forumlist_body.html<\/h4>\n<p>Find:<\/p>\n<pre class=\"lang:php decode:true \">\t\t\t\t\t&lt;dd class=\"lastpost\"&gt;&lt;span&gt;\r\n\t\t\t\t\t\t&lt;!-- IF forumrow.U_UNAPPROVED_TOPICS --&gt;\r\n\t\t\t\t\t\t\t&lt;a href=\"{forumrow.U_UNAPPROVED_TOPICS}\"&gt;{UNAPPROVED_IMG}&lt;\/a&gt;\r\n\t\t\t\t\t\t&lt;!-- ELSEIF forumrow.U_UNAPPROVED_POSTS --&gt;\r\n\t\t\t\t\t\t\t&lt;a href=\"{forumrow.U_UNAPPROVED_POSTS}\"&gt;{UNAPPROVED_POST_IMG}&lt;\/a&gt;\r\n\t\t\t\t\t\t&lt;!-- ENDIF --&gt;<\/pre>\n<p>Add after:<\/p>\n<pre class=\"lang:php decode:true \">\t&lt;!-- IF not .forumrow.subforum or not forumrow.S_LIST_SUBFORUMS --&gt;\r\n\t&lt;!-- IF not forumrow.S_WATCHING_FORUM --&gt;\r\n\t\t&lt;!-- IF forumrow.S_WATCH_FORUM_LIST_LINK and not S_IS_BOT and not forumrow.S_IS_LINK --&gt;&lt;a class=\"watch-icon-forum\" href=\"{forumrow.S_WATCH_FORUM_LIST_LINK}\"&gt;&lt;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.\" \/&gt;&lt;\/a&gt;&lt;!-- ENDIF --&gt;\r\n\t&lt;!-- ELSE --&gt;\r\n\t\t&lt;!-- IF forumrow.S_UNWATCH_FORUM_LIST_LINK and not S_IS_BOT and not forumrow.S_IS_LINK --&gt;&lt;a class=\"watch-icon-forum\" href=\"{forumrow.S_UNWATCH_FORUM_LIST_LINK}\"&gt;&lt;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.\" \/&gt;&lt;\/a&gt;&lt;!-- ENDIF --&gt;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t&lt;!-- ENDIF --&gt;\r\n\t&lt;!-- ENDIF --&gt;<\/pre>\n<p><em>Comments:<\/em><br \/>\n<em> Translation in french for title elements above:<\/em><br \/>\n<em> OFF: \u00ab\u00a0Actuellement, vous n&rsquo;\u00eates pas abonn\u00e9(e) \u00e0 ce forum. Cliquez ici pour vous ABONNER, ainsi vous recevrez un email lorsqu&rsquo;un nouveau message sera post\u00e9 dans ce forum.\u00a0\u00bb<\/em><br \/>\n<em> ON: \u00ab\u00a0Vous \u00eates actuellement abonn\u00e9(e) \u00e0 ce forum. Cliquez ici pour vous D\u00c9SABONNER et ne plus recevoir les emails de ce forum.\u00a0\u00bb<\/em><\/p>\n<p>Save the file.<\/p>\n<h4>File copy<\/h4>\n<p>Download icons.zip archive here:<\/p>\n<p><a href=\"http:\/\/darrigan.net\/blog\/wp-content\/uploads\/2017\/10\/icons.zip\" class=\"mtli_attachment mtli_zip\">icons<\/a><\/p>\n<p>and copy png files in your <span style=\"color: #0000ff;\">styles\/prosilver\/theme\/images\/<\/span> directory.<\/p>\n<p>I give you 3 sets of icons:<\/p>\n<p>&#8211; <span style=\"color: #0000ff;\">off.png<\/span>, <span style=\"color: #0000ff;\">off-faded.png<\/span> and <span style=\"color: #0000ff;\">on.png<\/span>: red (OFF), faded red (OFF) and green (ON) buttons 126&#215;54 px (big size, use it to make reductions as you like)<\/p>\n<p>&#8211; <span style=\"color: #0000ff;\">off-30.png<\/span>, <span style=\"color: #0000ff;\">off-faded-30.png<\/span> and <span style=\"color: #0000ff;\">on-30.png<\/span>: same but 70&#215;30 px (medium size)<\/p>\n<p>&#8211; <span style=\"color: #0000ff;\">off-20.png<\/span>, <span style=\"color: #0000ff;\">off-faded-20.png<\/span> and <span style=\"color: #0000ff;\">on-20.png<\/span>: same but 47&#215;20 px (small size, used in screen capture)<\/p>\n<p>The faded red is only an alternative for esthetic reason, if you consider there is too much flashy red on you forum\u2026<\/p>\n<h4>Final<\/h4>\n<p>Finally, clear cache via ACP, or by deleting all files in the <span style=\"color: #0000ff;\">\/cache<\/span> directory (except .htaccess and index.htm).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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:<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[39],"tags":[79,38,78],"_links":{"self":[{"href":"https:\/\/darrigan.net\/blog\/wp-json\/wp\/v2\/posts\/694"}],"collection":[{"href":"https:\/\/darrigan.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/darrigan.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/darrigan.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/darrigan.net\/blog\/wp-json\/wp\/v2\/comments?post=694"}],"version-history":[{"count":8,"href":"https:\/\/darrigan.net\/blog\/wp-json\/wp\/v2\/posts\/694\/revisions"}],"predecessor-version":[{"id":1007,"href":"https:\/\/darrigan.net\/blog\/wp-json\/wp\/v2\/posts\/694\/revisions\/1007"}],"wp:attachment":[{"href":"https:\/\/darrigan.net\/blog\/wp-json\/wp\/v2\/media?parent=694"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/darrigan.net\/blog\/wp-json\/wp\/v2\/categories?post=694"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/darrigan.net\/blog\/wp-json\/wp\/v2\/tags?post=694"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}