Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 51 through 75 (of 32,432 total)
  • Author
    Search Results
  • #244247
    DragoWeb
    Participant

    Same notice here, with v2.6.13. So I patched includes/extend/buddypress/loader.php

    line 42 : esc_html__( 'Forums', 'bbpress' ),
    to : function_exists('esc_html__') && did_action('init') ? esc_html__( 'Forums', 'bbpress' ) : 'Forums',

    and line 119 : 'search_string' => esc_html__( 'Search Forums...', 'bbpress' ),
    to : 'search_string' => did_action('init') ? esc_html__( 'Search Forums...', 'bbpress' ) : 'Search Forums...',

    and it’s gone.

    I had several similar notices from different plugins, and I suspect WPML to cause this issue. I can’t deavtivate it because last time I did it was a complete mess 😅

    I don’t have much time to go further this now, but I saw this topic so I guess Bbpress is not causing it.

    #244200

    In reply to: Memory Leak?

    Chefranov
    Participant

    I tried this hack

    add_action('all', function($tag) {
        static $count = 0;
        if (strpos($tag, 'acf') !== false && $count++ > 300) {
            error_log('ACF hook overflow: ' . $tag);
            exit;
        }
    });

    and it response:

    [17-Apr-2025 10:10:24 UTC] ACF hook overflow: gettext_acf

    #244160

    Topic: Memory Leak?

    in forum Troubleshooting
    Chefranov
    Participant

    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
    #244114
    Robin W
    Moderator

    On the users, bbpress hooks to user_id’s, so in the database you would have a topic/reply author just held in the database as for instance 27, and then bbpress looks up the nicename for that in the user table, so no user in the table, then no name to display.

    On import with no ‘import users’ if the username does not exist it puts it as 0, and then it is displayed as ‘anonymous’

    So whist everything is possible if you can write code or know someone who can, there is no easy way to import usernames, as you would need to amend both the import code and the username display code.

    I have no experience of phpBB, so cannot comment on the other aspects. The importer was written some time ago by someone who no longer is actively involved in bbpress.

    #244084
    yosmc
    Participant

    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!

    #244067
    Robin W
    Moderator

    thanks for that – I think I understand 🙂

    so the function that is used to display replies is is held in

    \bbpress\includes\replies\template.php line 576`

    function bbp_get_reply_content( $reply_id = 0 ) {
    		$reply_id = bbp_get_reply_id( $reply_id );
    
    		// Check if password is required
    		if ( post_password_required( $reply_id ) ) {
    			return get_the_password_form();
    		}
    
    		$content = get_post_field( 'post_content', $reply_id );
    
    		// Filter & return
    		return apply_filters( 'bbp_get_reply_content', $content, $reply_id );
    	}

    so

    add_filter( 'bbp_get_reply_content', 'my_function', 10 , 2) ;
    
    function my_function ($content, $reply_id ){
    	//your code here 
    
    }
    #244065
    annually2523
    Participant

    A user posts a topic. That topic now has a couple of replies. We have implemented a standard of referencing other replies without quoting by simply using a hashtag and a number. Like ‘#5’ would be a reply to reply number 5 in the topic.

    We currently have a plugin (that I did not write but have access to) that upon ‘commit’ or save will analyse the content of the reply and convert all #[NUMBER] strings into anchor references to other replies before content is saved to db.

    This is just not very practical because when that same reply is edited the #[NUMBER] has now been wrapped in a tag to make it a link making editing the # part very annoying if that’s what users want to do.

    Instead we would like to make the analyses and the conversion of the reply when the readout from db happens. Or at least before any text/replies are shown. That means the code has to run on every reply every time it needs to be shown, but the content save is as the user saved it.

    Does that make any sense?

    #244064
    Robin W
    Moderator

    can you explain a bit more about what you are wishing to achieve.

    eg user posts a topic/reply/either? and then before being published
    automatic text is added – then same text each time
    Someone looks at the posts and does a manual edit
    some code looks for x and changes it to y
    nothing in the database is changed, but before any display soemthing happens?

    etc.

    #244033
    izzi8181
    Participant

    Thanks for the reply! Hmm I wonder if I’m misidentifying what’s a title… I took a quick look at one of the pages and the title that’s showing (for example on that shop page) is the title I’ve typed in when creating the page (as an H1). So I’m thinking that means “title” in this case means that actual page title that’s auto-generated, and that’s what’s being hidden everywhere including on the forum pages.

    I looked in the section you suggested and the “forum title area” toggle was on for both single pages and archives.

    I also checked all the other areas in “custom post types” and the “title area” was on for all of them.

    Is there a code snippet I could put in that would override whatever it is and show the titles on my forum pages? (it seems that I don’t want the title auto-populated on my other site pages).

    Thanks so much for the help!

    neon67
    Participant

    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.

    #243747

    In reply to: Close topic label

    uksentinel
    Participant

    This is what I ended up using and seems to work well. If others are looking for CSS code that adds a “CLOSED” visual reference to the beginning of TOPICS Titles that have been closed, then try this and tweak to suit if needed.

    /* Add a “Closed” label to closed topics in bbPress */
    .status-closed .bsp-preview::before {
    content: “Closed”;
    background-color: #ff0000; /* Red background for visibility */
    color: #ffffff; /* White text color */
    padding: 2px 6px;
    margin-right: 10px;
    border-radius: 3px;
    font-size: 0.9em;
    font-weight: bold;
    }

    Example;
    https://uktechhub.com/wp/wp-content/uploads/2025/03/UKTH-Closed-Topic-icon.png

    #243738
    grem2016
    Participant

    Hi Robin,
    No, it was myself, some 8-years ago, when I added the forum. Since then we’ve added WP page content, images etc, and I’ve just kept it updated. The addition of the single BBpress forum on one page was very simple using the shortcode “bbp-single-forum”, with no other changes that I recall. Eventually I hope to remove all visible log-in possibilities, relying only on c-panel admin access for update/maintenance purposes.
    Maybe I’m missing something here, and removal of the site log-in widget will also remove the login option on the forum page. Did you already take a look to see what I mean? Under the “memories shared” tab, you will see further tabs, one of which is Forum, and that is where the other Login/register section is, below the forum topics. It is this part I would like to see removed so that the page is cleaner.
    Is that possible?
    Thanks in advance,
    Graham.

    #243736
    grem2016
    Participant

    Thank you.
    I looked into >appearance>widgets and the bbpress sidebar, but there was nothing added there.
    Under dashboard, I didn’t see a selection for “forums”. All I have is on the relevant page the shortcode added “[bbp-single-forum id=58]“.
    Does this help understand more about what I have?

    Best regards,
    Graham.

    #243696
    safeinsanity
    Participant

    Hi,

    Is there a css code that would hide/remove my sidebar from all buddypress pages?

    I found one that worked to remove the sidebar from bbpress so I was hoping that there would be one that worked for buddypress.

    This is the one that works to remove the sidebar from bbpress:

    `.bbPress #primary {
    display: none;
    }

    #243670
    Robin W
    Moderator

    As a test, can you try

    add_filter ('bbp_get_topic_reply_count', 'rew_return_int', 10 , 2) ;
    
    function rew_return_int ($replies, $topic_id ) {
    return int($replies) ;
    }

    Put this in your child theme’s function file –

    ie wp-content/themes/%your-theme-name%/functions.php

    where %your-theme-name% is the name of your theme

    or use

    Code Snippets

    and let me know if it works

    #243659
    Robin W
    Moderator

    either

    Install

    bbp style pack

    once activated go to

    dashboard>settings>bbp style pack>Topic/Topic/Reply Order>replies>Descending and tick and save

    or

    add_filter ('bbp_show_lead_topic', 'rew_true') ;
    
    function rew_true () {
    	return true ;
    }

    Put this in your child theme’s function file –

    ie wp-content/themes/%your-theme-name%/functions.php

    where %your-theme-name% is the name of your theme

    or use

    Code Snippets

    #243654
    Robin W
    Moderator

    ok, not having played with the BBpress for block theme which is what I suspect you are using :

    what exactly did you add to the template, can you post before and after code for this please as it will help others

    #243636
    webspaceunlimited
    Participant

    I have installed the plugin – and all appears good in that I have created a page and added the short code – and it the forum shows – however … thats where it all goes wrong clickiing on the forums or trying to paost asn I get blank screens
    I hve tried to debug this with gemini ai and it said create a page for each short code – did that – didnt work – then said copy the index.php file and rename it bbpress.php and drop that in the theme directory – did that and.. guess what didnt work either – also added a bbpress template layout in the theme and that too doesnt allow me to engage with the forum – I have gone through permalinks and literlally going round in circles and not getting anywhere amy help oor suggestions would be welcome – thank you

    #243576
    Robin W
    Moderator

    That’s a nice looking forum.

    The layoput is a combination of a custom template, some custom css and probably a couple of functions.

    I would strongly suspect it was put together by a design house, so is proprietary.

    I can only suggest you email the technical contact at the bottom of the website and see if they would be happy to share their code.

    duffy50
    Participant

    When I was looking at some of your example sites I really liked the way the topics were listed instead of just the number of topics on the following site — https://thebloodsugardiet.com/forums/

    I’ve been looking around and trying to find a way to list the topics, I do have the bbpress style plugin but didn’t see what I wanted.

    The current display of my forum looks like this — https://iowaminiz.com/membership-forum/

    I was hoping that I would not have to create a child theme and do code in the PHP files to accomplish this. I’m more comfortable with adding some CSS code.

    Thanks

    Oxibug
    Participant

    Good Day!

    The BuddyPress function bp_core_get_user_domain is deprecated since version 12.0.0, in \bbpress\includes\extend\buddypress\members.php

    Deprecated: Function bp_core_get_user_domain is deprecated since version 12.0.0! Use bp_members_get_user_url() instead

    I found this post https://bbpress.org/forums/topic/please-fix-this-problem/ and I don’t have BP Classic

    I found the function bp_core_get_user_domain in BuddyPress itself,
    file: (buddypress\bp-core\deprecated\12.0.php) is marked as Deprecated since version 12.0.0

    It’s very easy to replace the bp_core_get_user_domain to bp_members_get_user_url, I don’t know why it takes over a year to make this change!!

    #243444
    stracy2
    Participant

    I had to update my server, and was getting this error.

    Just as everyone has said, putting this snippet into my themes function.php fixed the error:

    add_filter('bbp_verify_nonce_request_url', 'custom_bbp_verify_nonce_request_url', 999, 1);
    
    function custom_bbp_verify_nonce_request_url($requested_url) {
        return 'https://www.yoursite.com' . $_SERVER['REQUEST_URI'];
    }

    PS Make sure your siteurl and home defines in wp-config.php are correct too.

    #243433

    👋 Hi there!

    It’s mostly still me working on bbPress, with bug reports & help here and there from the community which are always helpful and appreciated!

    I simply forgot to update the Codex page, so thank you for asking here 😅

    The build & release process is still pretty manual, because it includes updates to multiple WordPress pages & such (as you’ve all noticed here).

    (I do read the forums almost every day, and think they work best when I stay out of them and the community helps itself & each other – and moderators like @robin-w are obviously especially helpful.)

    #243428
    scratchy101
    Participant

    Thanks for that.
    I guess I was being silly by checking here instead: https://codex.bbpress.org/releases/

    In the plugin admin page I had clicked on View Details > Changelog > Check out the releases page.
    Cheers
    Art

    #243352
    stableartai
    Participant

    Seem this part of code cause the removal of dashboard forum items.

    add_filter( ‘bbp_get_caps_for_role’, ‘ST_add_role_caps_filter’, 10, 2 );

Viewing 25 results - 51 through 75 (of 32,432 total)
Skip to toolbar