• The time has come to vote for the NEW name of the site! Check out the stickied thread in TLR. Get your votes in now, poll will be closing in six days.

I'm still getting emails even though I turned them off

@WhatsGoodTy Did you turn off the "Automatically watch content you interact with..." option? it's on your Preferences. If you don't, you'll get emails every time, it happened to me yesterday until I figured it out.

1759588817710.png
 
try turning on the setting then turning it off again..
ld.png
 
After you turn off email notifications in your profile settings, you'll then need to go to every thread you participated in prior to doing and select the Unwatch option for it.After this, you should no longer receive any emails. If you don't want to go through and find the threads yourself, you can just wait for an email notification and then go to the thread from there to unwatch it.
 
After you turn off email notifications in your profile settings, you'll then need to go to every thread you participated in prior to doing and select the Unwatch option for it.After this, you should no longer receive any emails. If you don't want to go through and find the threads yourself, you can just wait for an email notification and then go to the thread from there to unwatch it.



made a bookmarklet to that should bulk unwatch threads before a specified date. click on your username at the top and select "your content", run the code on that page.



## 📘 Project: xenforo forum User Search Filter + Unwatch Bookmarklet

**Title:**
xenforo forum Forum — User Post Filter & Thread Unwatch Manager

**Purpose:**
To let a user automatically crawl through their xenforo forum user search pages (e.g. `https://www.xenforo forum.com/search/887/?c[users]=username&o=date`), find threads before a chosen date, and optionally “Unwatch” them all.

---

### 1. Functional Summary

| Feature | Description |
| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Scope** | Works only on pages that match `https://www.xenforo forum.com/search/*` |
| **Dynamic User Detection** | Extract `username` automatically from the `c[users]` parameter in the page’s query string. |
| **Cutoff Filter** | Prompt user for a date (e.g., `2025-09-01`), and collect all threads where the `<time class="u-dt" datetime="...">` value is earlier than that date. |
| **Pagination** | Automatically traverse through all pages by reading `.pageNav-page a[href*="page="]` links. |
| **Unwatch Option** | After listing filtered threads, the user can choose to automatically unwatch each of them by following their thread page and clicking the `<a data-sk-unwatch="Unwatch">` link. |
| **Output** | Results shown via alerts and console logs (thread URL, post date). |
| **Safety** | Does not send external requests; uses xenforo forum’s same-origin credentials. |

---

## 🧠 Full JavaScript Code (Readable)

```javascript
Code:
(async () => {
  // Extract username from URL query parameters
  const params = new URLSearchParams(window.location.search);
  const username = params.get("c[users]");
  if (!username) {
    alert("Username not found in URL (missing c[users] parameter).");
    return;
  }

  // Ask user for cutoff date
  const cutoffInput = prompt(`Enter cutoff date for user "${username}" (YYYY-MM-DD):`);
  if (!cutoffInput || isNaN(Date.parse(cutoffInput))) {
    alert("Invalid date format. Use YYYY-MM-DD.");
    return;
  }
  const cutoffDate = new Date(cutoffInput);

  if (!confirm(`Scan all pages for posts by "${username}" before ${cutoffDate.toDateString()}?`)) return;

  // Collect all pagination links
  const pageLinks = [...document.querySelectorAll('.pageNav-page a')].map(a => a.href);
  pageLinks.unshift(window.location.href); // include current page

  let matchedThreads = [];

  // Process each page
  for (const pageUrl of pageLinks) {
    console.log(`Fetching page: ${pageUrl}`);
    try {
      const resp = await fetch(pageUrl, { credentials: 'include' });
      const html = await resp.text();
      const doc = new DOMParser().parseFromString(html, "text/html");

      // Find posts and filter by date
      const times = doc.querySelectorAll('ul.listInline li time.u-dt');
      times.forEach(timeEl => {
        const dateAttr = timeEl.getAttribute("datetime");
        const postDate = new Date(dateAttr);
        if (postDate < cutoffDate) {
          const threadLink = timeEl.closest('ul').querySelector('a[href*="/threads/"]');
          if (threadLink) {
            matchedThreads.push({
              url: threadLink.href,
              date: postDate
            });
          }
        }
      });
    } catch (err) {
      console.warn(`Error fetching ${pageUrl}:`, err);
    }
  }

  console.log(`✅ Found ${matchedThreads.length} threads by "${username}" before ${cutoffDate.toDateString()}.`);
  console.table(matchedThreads.map(t => ({ Date: t.date.toISOString(), Thread: t.url })));

  // Optional unwatch step
  if (matchedThreads.length && confirm(`Unwatch all ${matchedThreads.length} threads by "${username}"?`)) {
    for (const t of matchedThreads) {
      try {
        const res = await fetch(t.url, { credentials: 'include' });
        const pageText = await res.text();
        const pageDoc = new DOMParser().parseFromString(pageText, "text/html");
        const unwatchLink = pageDoc.querySelector('a[data-sk-unwatch="Unwatch"]');
        if (unwatchLink) {
          await fetch(unwatchLink.href, { credentials: 'include' });
          console.log(`Unwatched: ${t.url}`);
        }
      } catch (e) {
        console.warn(`Failed to unwatch ${t.url}:`, e);
      }
    }
    alert(`✅ Finished unwatching ${matchedThreads.length} threads.`);
  } else {
    alert(`Found ${matchedThreads.length} threads by "${username}" before ${cutoffDate.toDateString()}.\nSee console for details.`);
  }
})();
```

---

## ⚙️ Bookmarklet Version (Minified, Ready to Use)

> 💡 **How to install:**
>
> 1. Copy the entire line below.
> 2. Create a new browser bookmark.
> 3. Paste this code into the **URL** field.
> 4. On any xenforo forum search page (e.g. `...?c[users]=YourName&o=date`), click the bookmark.

```
Code:
javascript:(async()=>{const e=new URLSearchParams(location.search).get("c[users]");if(!e)return alert("Username not found in URL (missing c[users] parameter).");const t=prompt(`Enter cutoff date for user "${e}" (YYYY-MM-DD):`);if(!t||isNaN(Date.parse(t)))return alert("Invalid date format. Use YYYY-MM-DD.");const a=new Date(t);if(!confirm(`Scan all pages for posts by "${e}" before ${a.toDateString()}?`))return;const n=[...document.querySelectorAll(".pageNav-page a")].map(e=>e.href);n.unshift(location.href);let o=[];for(const r of n){console.log("Fetching page:",r);try{const e=await fetch(r,{credentials:"include"}),t=await e.text(),n=new DOMParser().parseFromString(t,"text/html");n.querySelectorAll("ul.listInline li time.u-dt").forEach(e=>{const t=e.getAttribute("datetime"),n=new Date(t);if(n<a){const t=e.closest("ul").querySelector('a[href*="/threads/"]');t&&o.push({url:t.href,date:n})}})}catch(e){console.warn("Error fetching",r,e)}}console.log(`✅ Found ${o.length} threads by "${e}" before ${a.toDateString()}.`),console.table(o.map(e=>({Date:e.date.toISOString(),Thread:e.url}))),o.length&&confirm(`Unwatch all ${o.length} threads by "${e}"?`)?(await Promise.all(o.map(async t=>{try{const e=await fetch(t.url,{credentials:"include"}),a=await e.text(),n=new DOMParser().parseFromString(a,"text/html"),o=n.querySelector('a[data-sk-unwatch="Unwatch"]');o&&(await fetch(o.href,{credentials:"include"}),console.log("Unwatched:",t.url))}catch(e){console.warn("Failed to unwatch",t.url,e)}})),alert(`✅ Finished unwatching ${o.length} threads.`)):alert(`Found ${o.length} threads by "${e}" before ${a.toDateString()}.\nSee console for details.`)})();
```

---

## ✅ Example Use

1. Go to a page like:

```
https://www.xenforo forum.com/search/887/?c[users]=usernameGoesHere&o=date
```

2. Click your bookmarklet.

3. When prompted, enter a date (e.g. `2025-09-01`).

4. The script will:

* Identify the username dynamically (`usernameGoesHere`),
* Crawl all pages of results,
* Filter by date,
* Offer to unwatch old threads.

5. See the detailed results in your browser’s console (press **F12 → Console**).

---

Would you like me to add an option so the results (URLs + dates) are also **downloaded as a CSV file** for record-keeping or backup?
 
Last edited:
Back
Top