Allow users to fully ignore/hide other users

Looking for an Extension? Have an Extension request? Post your request here for help. (Note: This forum is community supported; while there is an Extensions Development Team, said team does not dedicate itself to handling requests in this forum)
Ideas Centre
User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 6624
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.

Re: Allow users to fully ignore/hide other users

Post by thecoalman »

Gumb00ts wrote: It's already done for posts, so doing it for quotes should not be particularly difficult.
It's easy to do it for posts because you have direct reference for the user id. That's not the case for quotes since it's stored with the post data and I'll add easily manipulated. See the quote box above for reference.
“Results! Why, man, I have gotten a lot of results! I have found several thousand things that won’t work.”

Attributed - Thomas Edison
User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 6624
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.

Re: Allow users to fully ignore/hide other users

Post by thecoalman »

privet.fun wrote: Wed Jan 08, 2025 11:57 pm I have these features implemented on my forum since mid-2023:

Code: Select all

    // workaround to get list of foes -- we fetch the entire page and parse it to get a list of foes
    xhttp.open("GET", "/ucp.php?i=ucp_zebra&mode=foes", true);
    xhttp.send();
That's pretty expensive to get list of foes. At some point there is probably an array of foes available while viewtopic is executing and you can just set it as template variable.
“Results! Why, man, I have gotten a lot of results! I have found several thousand things that won’t work.”

Attributed - Thomas Edison
User avatar
danieltj
Infrastructure Team Member
Infrastructure Team Member
Posts: 690
Joined: Thu May 03, 2018 9:32 pm
Location: United Kingdom
Name: Daniel James

Re: Allow users to fully ignore/hide other users

Post by danieltj »

Based on what I've read so far, it's safe to assume that hacking together bits of JavaScript and CSS is clearly not the way to do this. If that works for you then power to you, but an extension that filters post content based on your foes is the only way to go about this. Quotes will be sort of tricky because some quotes might be modern (3.3 quotes for example have user IDs etc) but legacy quotes or 'basic' (like in 3.0) ones written by users that just have the username will be even trickier to filter out.
MY EXTENSIONS:
Verified Profiles | API | Awesome Payments

Available for paid extension work.
User avatar
Gumboots
Registered User
Posts: 821
Joined: Fri Oct 11, 2019 1:59 am

Re: Allow users to fully ignore/hide other users

Post by Gumboots »

thecoalman wrote: Fri Jan 10, 2025 8:04 am
Gumb00ts wrote: It's already done for posts, so doing it for quotes should not be particularly difficult.
It's easy to do it for posts because you have direct reference for the user id. That's not the case for quotes since it's stored with the post data and I'll add easily manipulated.
Good point. There's also the possibility of people splitting a quoted foe post to allow a more detailed reply.

See the quote box above for reference.
In which case you are totally screwed for hiding it.

So, can be done for foe quotes which contain user ID, but cannot be done (sanely) for foe quotes that lack user ID.
🇺🇦 Слава Україні! 🇺🇦 Героям слава! 🇺🇦
User avatar
Gumboots
Registered User
Posts: 821
Joined: Fri Oct 11, 2019 1:59 am

Re: Allow users to fully ignore/hide other users

Post by Gumboots »

danieltj wrote: Fri Jan 10, 2025 11:01 am Based on what I've read so far, it's safe to assume that hacking together bits of JavaScript and CSS is clearly not the way to do this. If that works for you then power to you...
I used custom CSS just to clean up the default presentation for ignored and deleted posts. IOW, not an addition to the default ignore system, just a way of making it less obtrusive and reducing the amount of scrolling required.

ignored_posts.png

This had been very popular, because people really do not want to read the default ignored posts blurb (including the username of their foes). They just want to know it's a post they're ignoring and can skip without worrying about it. As I said, deleted posts get the same treatment for the staff. The link to view the post is still functional if required. It's clean and effective. IMO this is a valid use of CSS.

Code: Select all

.postbody > .ignore {
	position: relative;
	overflow: hidden;
	height: 16px;
	padding: 2px 4px 0;
	font-size: 12px !important;
	line-height: 16px;
}
.postbody > .ignore::before {
	display: block;
	font-style: italic;
	content: 'Ignored post.';
}
.postbody > .ignore a {
	position: absolute;
	top: 0;
	right: 4px;
}
.postbody > .ignore a::before {
	display: block;
	padding: 2px 4px 0;
	content: 'Here be dragons.';
}

This is all on default markup. No template hacks are required.

Code: Select all

<div class="ignore" id="post_hidden138261">
	<strong>
		<a href="./memberlist.php?mode=viewprofile&amp;u=91" style="color: #BF8040;" class="username-coloured">
			Foe Name
		</a>
	</strong>, who is currently on your ignore list, made this post.
	<br>
	<a class="display_post" data-post-id="138261" href="./viewtopic.php?p=138261&amp;view=show#p138261">
		Display this post
	</a>
</div>

And yes, I added the CSS to an extension we were already running (one of mine) so it applies to all styles. ZOMG, Gumboots will actually use extensions sometimes. Don't tell anyone. :lol:
You do not have the required permissions to view the files attached to this post.
🇺🇦 Слава Україні! 🇺🇦 Героям слава! 🇺🇦
tahiti
Registered User
Posts: 9
Joined: Sat Nov 16, 2024 10:33 am

Re: Allow users to fully ignore/hide other users

Post by tahiti »

privet.fun wrote: Wed Jan 08, 2025 11:57 pm I have these features implemented on my forum since mid-2023:

1. Global ignore: thread in Russian. It is basically a script running in the browser that hides all foes' replies (for some reason, phpBB does not do that out of the box).

Code: Select all

<script>

function removeAnnoyingQuotes(foes)
{
    var count = 0;
    for (var userInd = 0; userInd < foes.length; userInd ++) {
        let userLink = "./memberlist.php?mode=viewprofile&u=" + foes[userInd][0]
        var quoteNodes = document.evaluate(
            "//a[@href='" + userLink + "']",
            document,
            null,
            XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
            null);
        for (var i = 0; i < quoteNodes.snapshotLength; i++) {
            var authorElement = quoteNodes.snapshotItem(i);
            let p1 = authorElement.parentElement;
            if (p1 && p1.nodeName === "CITE") {
                let p2 = p1.parentElement;
                if (p2) {
                    p2.innerHTML = blockedUserQuoteText(p2, foes[userInd][1]);
                    count++; 
                }
            }
        }
    }
    return count;
}

function removeAnnoyingFuzzyQuotes(foes)
{
    var count = 0;
    var quoteNodes = document.evaluate(
        "//cite",
        document,
        null,
        XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
        null);
    for (var i = 0; i < quoteNodes.snapshotLength; i++) {
        var el = quoteNodes.snapshotItem(i);
        if (el.parentElement.nodeName === "DIV" && el.parentElement.parentElement.nodeName === "BLOCKQUOTE") {
            var title = el.textContent
            for (var userInd = 0; userInd < foes.length; userInd ++) {
                if (title.startsWith(foes[userInd][1] + " ")) {
                    var foeBlock = el.parentElement;
                    foeBlock.innerHTML = blockedUserQuoteText(foeBlock, foes[userInd][1]);
                    count++;
                    break;
                }
            }
        }
    }
    return count;
}

var ignoreQuoteId = 0;

function blockedUserQuoteText(parent, foeName) {

  ignoreQuoteId = ignoreQuoteId + 1;

  var result = '<div id="quote_hidden' + ignoreQuoteId +  '">The author of <a class="display_hidden_quote" data-quote-id="' + ignoreQuoteId + '" href="./viewtopic.php">message</a> является <b>' + foeName + '</b>, is in your foe list.</div><div id="quote_content' + ignoreQuoteId + '" style="display: none;">' + parent.innerHTML + '</div>';

  return result;
}

(function() {
    'use strict';

    var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function() {
         if (this.readyState == 4 && this.status == 200) {
             let text = this.responseText;
             let ind1 = text.indexOf("<select name=\"usernames[]\"");
             if (ind1 != -1) {
                 let optSearch = "<option value=\"";
                 let ind2 = text.indexOf("</select>", ind1);
                 let foeBlob = text.substring(ind1, ind2);
                 // console.log("FOE " + foeBlob);
                 var ind = 0;
                 var foes = Array();
                 while (true) {
                     ind = foeBlob.indexOf(optSearch, ind);
                     if (ind == -1) {
                         break;
                     }
                     var endIdInd = foeBlob.indexOf("\">", ind);
                     var foeId = foeBlob.substring(ind + optSearch.length, endIdInd);
                     var endNameInd = foeBlob.indexOf("</option>", endIdInd)
                     var foeName = foeBlob.substring(endIdInd + 2, endNameInd);
                     foes.push([foeId, foeName]);
                     ind = endNameInd;
                 }
                 if (foes.length > 0) {
                     var count = removeAnnoyingQuotes(foes);
                     count = count + removeAnnoyingFuzzyQuotes(foes);

                      if(count) {
                         $('.display_hidden_quote').on('click', function(e) {
                        	e.preventDefault();
                     	 	var quoteId = $(this).attr('data-quote-id');
                     	 	$('#quote_content' + quoteId).show();
                       	 	$('#quote_hidden' + quoteId).hide();
                       });
                     }
                 }
             }
         }
    };
    // workaround to get list of foes -- we fetch the entire page and parse it to get a list of foes
    xhttp.open("GET", "/ucp.php?i=ucp_zebra&mode=foes", true);
    xhttp.send();
})();

</script>
I added above script to /styles/prosilver/template/viewtopic_body.html

2. Hide Foe Topics v1.0.0 https://github.com/privet-fun/phpbb_hidefoetopics

I was contemplating combining both into a single plugin but never got around to doing that.

BTW it's still not an optimal solution as in my experience it's not that easy to completely cut a foe out from the topic conversation thread.
This is because of the "flat" structure of phpBB topics/threas where a user can quote multiple people in one post.
Ideally you would want to hide replies from other users to the post made by a foe (perhaps this could be an option) but it's not that simple since a user can quote multiple people in a post.
In a tree-like conversation structure like the ones on Twitter you can simply cut a foe's reply and all the replies linked downwards.
That extension is actually exactly what I was looking for. Thank you so much. I think my users will be happy with just that. If there are further complaints about quoted replies, etc, I may look into your other suggestions but I think this will be a great start. Thanks again!
tahiti
Registered User
Posts: 9
Joined: Sat Nov 16, 2024 10:33 am

Re: Allow users to fully ignore/hide other users

Post by tahiti »

Sorry to all contributors for seemingly abandoning this topic for a while. I got busy irl. Thanks for all suggestions and help.

Return to “Extension Requests”