Search Results for 'code'
-
Search Results
-
I’m running WP 6.8.1 wih bbp 2.6.13 and bbp style pack 6.3.0 on the Twenty Twenty-Four theme.
When I view my forum as a logged in user, I get this at the head of the page:
Private: Private: Constitution
Is there a way to suppress this?
It’s probably me… 🙂
I’m running WP 6.8.1 wih bbp 2.6.13 and bbp style pack 6.3.0 on the Twenty Twenty-Four theme.
When I view my forum as a logged in user, I see this under the Last Activity section:
Last Activity: <a href="https://scottishpolicy.org/forums/topic/right-to-privacy/" title="Right to privacy">1 day, 9 hours ago</a>
I’ve used Inspector to look at the code in the browser (Firefox and Brave – both are affected) and I can’t spot anything obvious.
Is this a known issue?
Is there a fix?
Topic: Change bbPress permalinks
Hello..
Yes, I want Change my bbPress permalinks in my forum,
from:
to:
https://bbpress.org/troubleshooting/error-5/So, I want:
Delete: forums
Delete: topic
Add: ForumName “not forums btw”Can I do that plz?
E.T.A.
Why?
Because my forum will be about cars, I’ll want to include the car brand in the permanent link.For example:
https://cars.com/bmw/why-my-bmw-app-is-not-working
Topic: Error
Hi there,
We’re using bbPress with the Simple Membership plugin, and the site is built with the GeneratePress theme. Here’s the staging site for reference: https://iu9d4mv2wm-staging.onrocket.site/forums/
Login is handled through Simple Membership, but profile behavior is different than the typical bbPress/WordPress setup.
When a member creates a topic or reply, they can click on their avatar or name to access their forum profile — which includes favorites, subscriptions, activity, etc. However, if a user hasn’t posted yet, there’s no way for them to access their profile, because their avatar/name doesn’t appear anywhere.
Is there a shortcode, function, or recommended method to add a “View My Profile” link at the top of the forums (or anywhere else), even if the user hasn’t posted?
Thanks in advance for any guidance!
Topic: Memory Leak?
When I open Dashboard → Replies → Add new reply I get 500 error and this in php logs:
[16-Apr-2025 13:27:10 UTC] PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 262144 bytes) in /Users/chefranov/Sites/mysite.loc/wp-includes/class-wp-object-cache.php on line 363 [16-Apr-2025 13:27:10 UTC] PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 262144 bytes) in /Users/chefranov/Sites/mysite.loc/wp-includes/class-wp-fatal-error-handler.php on line 37
Hi all,
I’ve been doing a test run today to import my old phpBB board to bbpress, and it worked surprisingly well (as in: the whole process finished without hanging).
In the end, though, I do have a number of problems, and I was wondering if anyone doing a similar import was able to solve them.
– The old board has thousands of registered users (many of them spammers :/ ), and I didn’t want to clutter my WordPress install with all those accounts, especially since it’s a multisite install and I’m mainly migrating the board for archiving purposes. So I didn’t check the “import user accounts” box, but now all user names are just “Anonymous”. Any way to migrate the user names without the accounts?
– It seems like quoted posts are broken, as the “bbcode_quote” tag isn’t applied where it should be.
– Smilies aren’t imported properly. The relative path to the smilies is lost, and when there’s more than one smiley in a row, only the first one has an image tag.
– [img] tags aren’t being properly converted either. Or rather the conversion seems to work ok, but after the actual link, the [img] code, which bbpress can’t read, is retained for some reason.
– Like I said, overall conversion seemed to work well, but cluttered the error log with hundreds of these messages:
PHP Warning: Trying to access array offset on value of type bool in /wp-content/plugins/bbpress/includes/admin/parser.php on line 1289
Anything to worry about?
– I understand that no attachments are imported by default, but maybe someone found a workaround?
Thanks!
Perhaps someone will find it useful. This code does not load the system and saves the result in temporary storage.
// Function to fetch the latest image from a topic async function fetchLatestImageFromTopic(topicUrl) { // Check if there is cached data and if it is fresh let cachedData = localStorage.getItem('latestImageData'); let cachedTimestamp = localStorage.getItem('latestImageTimestamp'); const cacheLifetime = 24 * 60 * 60 * 1000; // 24 hours // If there is cached data and it's fresh, display it if (cachedData && cachedTimestamp && (Date.now() - cachedTimestamp < cacheLifetime)) { document.getElementById('latest-image-container').innerHTML = cachedData; return; } // Request to the server to get the topic data try { const response = await fetch(topicUrl); if (!response.ok) throw new Error('Page load error'); const text = await response.text(); const parser = new DOMParser(); const doc = parser.parseFromString(text, 'text/html'); // Extract all replies in the topic const replies = Array.from(doc.querySelectorAll('.bbp-reply')); let latestImage = null; let latestDate = 0; let heading = ''; let description = ''; // Loop through all replies and find the freshest image for (let reply of replies) { const postDate = new Date(reply.querySelector('.bbp-post-meta .bbp-post-date').textContent).getTime(); const img = reply.querySelector('img'); if (img && postDate > latestDate) { latestImage = img; latestDate = postDate; heading = reply.querySelector('h3') ? reply.querySelector('h3').innerText : ''; description = reply.textContent.trim().replace(heading, '').trim(); } } // If an image is found, create HTML content if (latestImage) { const imgSrc = latestImage.getAttribute('src'); const imgAlt = latestImage.getAttribute('alt') || ''; const outputHtml = <div style="text-align: center;"> ${heading ? <code><h3>${heading}</h3></code> : ''} <img src="${imgSrc}" alt="${imgAlt}" /> ${description ? <code><p>${description}</p></code> : ''} </div> ; // Save the data in local storage localStorage.setItem('latestImageData', outputHtml); localStorage.setItem('latestImageTimestamp', Date.now()); // Display the result on the page document.getElementById('latest-image-container').innerHTML = outputHtml; } else { document.getElementById('latest-image-container').innerHTML = '<p>No images found.</p>'; } } catch (error) { console.error('Error:', error); } } // Call the function with the topic URL fetchLatestImageFromTopic('https://www - yours - topic');
How This Code Works:
Cache Check:First, we check if there is any cached data in localStorage.
If the data exists and is still fresh (within the last 24 hours), we display it on the page.
Server Request:
If there is no cache or it’s outdated, we send an AJAX request to the server to retrieve the topic data.
We only need to parse the HTML content to extract images and publication dates.
Finding the Freshest Image:
We loop through all the replies and extract the image and publication date.
If the date of the current reply is more recent than the previous one, we update the image and data.
Caching the Result:
After finding the freshest image and associated content, we save the result in localStorage so we don’t need to make repeated requests.
Displaying the Result:
We display the result on the page, including the image, heading (if available), and description.
Where to Place This Code?
HTML: Insert this code within a <script> block on the page where you want to display the image.