Coucou,
just a brief resource that @jucarese asked me, and that I am willing to share with everyone
with the subforum IDs where you want to enable the like/dislike option. Any forum with an ID not in this list, will have the option remove.
The example will allow sub-forums with IDs 4 -15 and 258 to have the like feature. A topic in the sub forum with ID 27 will have the like feature removed from all its posts and topics.
just a brief resource that @jucarese asked me, and that I am willing to share with everyone
Description
The tutorial allows you to decide on which subforums' topics the option to "Like/Dislike" can be enabled. If the topic is in a sub-forum not enabled to use the like option, this will be removed.Installation: Javascript
You need to go towards Administration Control Panel (ACP) Modules HTML & Javascript Javascript codes management and create a new code - upon verifying that Javascript codes management is enabled.- Title: free choice - does not influence the code effect
- Where: In topics
- Code:
- Code:
$(function() {
/*
Title: Enable/Disable Like feature according to sub-forums
Author: Niko
Version: 1.0
Release Date: 03.06.2023 (dd.mm.year)
Contact: https://www.fmcodes.net/u2
Original content: https://www.fmcodes.net/t2036-
*/
var enabled_forums = ['4','15','258']; //this is the only customization necessary
const FORUM_VERSION = _userdata["tpl_used"];
var breadcrumb_subforum = {
'subsilver': 'table td.nav span.nav a.nav[href*="/f"]', //phpbb2
'prosilver': '.topic-actions .pathname-box p a.nav[href*="/f"]', //phpbb3
'punbb': '.pun-crumbs.noprint.clearfix span.crumbs a.nav[href*="/f"]', //punBB
'invision': 'ul#navstrip li a.nav[href*="/f"]', //invision
'modernbb': '.sub-header .sub-header-info .sub-header-path a + a', //modernBB
'awesomebb': 'div#breadcrumbs.breadcrumbs-topic a+a' //awesomeBB
};
var like_block = {
'subsilver': '.fa_like_div', //phpbb2
'prosilver': '.fa_like_div', //phpbb3
'punbb': '.fa_like_div', //punBB
'invision': '.fa_like_div', //invision
'modernbb': '.fa_like_div', //modernBB
'awesomebb': '.fa_like_div' //awesomeBB
};
var subforum_path = $(breadcrumb_subforum[FORUM_VERSION]).attr('href');
var forum_id = subforum_path.split('/f').pop().split('-')[0];
if(enabled_forums.indexOf(forum_id) == -1) {
$(like_block[FORUM_VERSION]).remove();
}
});
Customization
You only have to customize the content of the variable
|
The example will allow sub-forums with IDs 4 -15 and 258 to have the like feature. A topic in the sub forum with ID 27 will have the like feature removed from all its posts and topics.