Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 1 through 25 (of 32,358 total)
  • Author
    Search Results
  • #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 );

    #243351
    stableartai
    Participant

    The code seem to work just fine, tried both plug-in and hard code to theme. Issue is when active it remove the dashboard items o manage the forum. Even in plug-ins the settings link is missing from the BBPress plug-in.

    We currently use the most recent php 8 and WP 6 as of 2025 and buddypress and bbpress.

    Unsure of what else it might break so currently have it disable.

    source plug-in:
    https://gist.github.com/ntwb/56ab5a4eab8bbcdc90fc2bdfc2c57838

    #243348
    Robin W
    Moderator

    If you have exported press from another site, and then imported- yes series, and post parents for topics and replies can be wrong where on the imported site there are existing users, posts or pages. There are no easy solutions – I have some code that should fix replies, but I am on holiday at the moment with no access

    #243309
    Clivesmith
    Participant

    OK There seems to be no fixed reason that the replies are rejected, one minute it works and next it does not. I have 2 pages 1 Thank you page and 1 error page. I am running through cloudflare so I am not sure if that is causing the problem.
    This code I have added to the function.php seems to be working

    // 1 Check if the reply submission has missing fields & redirect to the error page
    add_action(‘template_redirect’, ‘rew_check_reply_submission’);

    function rew_check_reply_submission() {
    // Check if a reply is being submitted
    if (isset($_POST[‘bbp_reply_submit’])) {
    // Check if required fields are missing (e.g., content, forum, topic)
    if (empty($_POST[‘bbp_reply_content’]) || !isset($_POST[‘bbp_forum_id’]) || !isset($_POST[‘bbp_topic_id’])) {
    // Grab the topic ID from the form (ensure it’s valid)
    $topic_id = !empty($_POST[‘bbp_topic_id’]) ? intval($_POST[‘bbp_topic_id’]) : 0;

    // Redirect to the error page with the topic ID
    wp_redirect(site_url(‘/reply_error/?topic_id=’ . $topic_id));
    exit; // Stop the script execution after the redirect
    }
    }
    }

    // 2️ Modify reply redirection: If pending, go to moderation page
    add_filter(‘bbp_new_reply_redirect_to’, ‘rew_pending_check’, 30, 3);

    function rew_pending_check($reply_url, $redirect_to, $reply_id) {
    $status = get_post_status($reply_id);
    $topic_id = bbp_get_reply_topic_id($reply_id);

    // If the reply is pending moderation, redirect to the moderation page
    if ($status === ‘pending’) {
    return site_url(‘/moderation/?moderation_pending=’ . $topic_id);
    }

    return $reply_url; // Otherwise, return the usual redirect URL
    }

    // 3 Create a shortcode [mod-return] to display “Return to Topic” on error and moderation pages
    add_shortcode(‘mod-return’, ‘mod_return’);

    function mod_return() {
    // Get the topic ID from the URL (works for both error and moderation pages)
    $topic_id = !empty($_GET[‘topic_id’]) ? intval($_GET[‘topic_id’]) : (!empty($_GET[‘moderation_pending’]) ? intval($_GET[‘moderation_pending’]) : 0);

    // If a valid topic ID is found, generate the “Return to Topic” button
    if ($topic_id) {
    $topic_url = get_permalink($topic_id);

    if ($topic_url) {
    return ‘<div class=”mod-return” style=”text-align:center; margin-top:20px;”>
    <a href=”‘ . esc_url($topic_url) . ‘”
    style=”color:white; background-color:tomato; padding:12px 20px;
    border-radius:5px; text-decoration:none; font-size:16px;”>
    ⬅ Return to Topic

    </div>’;
    }
    }

    // If no valid topic ID found, return nothing or a message
    return ‘<p style=”text-align:center; color:red;”>No topic found to return to.</p>’;
    }

    #243308
    Clivesmith
    Participant

    OK so just to let you know this is what I have and it seems to be working, There does not seem to be any fixed reason that the replies get rejected without warning. I am running cloudflare so I cannot rule that out.
    I have two pages, a thank you page and an error page, this code is in my function.php which seems to be working.

    
    // 1 Check if the reply submission has missing fields & redirect to the error page
    add_action('template_redirect', 'rew_check_reply_submission');
    
    function rew_check_reply_submission() {
        // Check if a reply is being submitted
        if (isset($_POST['bbp_reply_submit'])) {
            // Check if required fields are missing (e.g., content, forum, topic)
            if (empty($_POST['bbp_reply_content']) || !isset($_POST['bbp_forum_id']) || !isset($_POST['bbp_topic_id'])) {
                // Grab the topic ID from the form (ensure it's valid)
                $topic_id = !empty($_POST['bbp_topic_id']) ? intval($_POST['bbp_topic_id']) : 0;
                
                // Redirect to the error page with the topic ID
                wp_redirect(site_url('/reply_error/?topic_id=' . $topic_id));
                exit; // Stop the script execution after the redirect
            }
        }
    }
    
    // 2️ Modify reply redirection: If pending, go to moderation page
    add_filter('bbp_new_reply_redirect_to', 'rew_pending_check', 30, 3);
    
    function rew_pending_check($reply_url, $redirect_to, $reply_id) {
        $status = get_post_status($reply_id);
        $topic_id = bbp_get_reply_topic_id($reply_id);
    
        // If the reply is pending moderation, redirect to the moderation page
        if ($status === 'pending') {
            return site_url('/moderation/?moderation_pending=' . $topic_id);
        }
    
        return $reply_url; // Otherwise, return the usual redirect URL
    }
    
    // 3 Create a shortcode [mod-return] to display "Return to Topic" on error and moderation pages
    add_shortcode('mod-return', 'mod_return');
    
    function mod_return() {
        // Get the topic ID from the URL (works for both error and moderation pages)
        $topic_id = !empty($_GET['topic_id']) ? intval($_GET['topic_id']) : (!empty($_GET['moderation_pending']) ? intval($_GET['moderation_pending']) : 0);
    
        // If a valid topic ID is found, generate the "Return to Topic" button
        if ($topic_id) {
            $topic_url = get_permalink($topic_id);
    
            if ($topic_url) {
                return '<div class="mod-return" style="text-align:center; margin-top:20px;">
                            <a href="' . esc_url($topic_url) . '" 
                               style="color:white; background-color:tomato; padding:12px 20px; 
                                      border-radius:5px; text-decoration:none; font-size:16px;">
                                ⬅ Return to Topic
                            </a>
                        </div>';
            }
        }
    
        // If no valid topic ID found, return nothing or a message
        return '<p style="text-align:center; color:red;">No topic found to return to.</p>';
    }
    
    
    #243278
    Clivesmith
    Participant

    Hi Robin
    Thank you, I have now tracked it down to the following code in my functions.php

    add_filter (‘bbp_new_reply_redirect_to’ , ‘rew_pending_check’, 30 , 3) ;

    function rew_pending_check ($reply_url, $redirect_to, $reply_id) {
    $status = get_post_status ($reply_id) ;
    $topic_id = bbp_get_reply_topic_id( $reply_id );
    if ($status == ‘pending’ ) {
    $reply_url = ‘/moderation/?moderation_pending=’.$topic_id ;
    }
    return $reply_url ;
    }

    add_shortcode (‘mod-return’ , ‘mod_return’ ) ;

    function mod_return () {
    if (!empty($_REQUEST[‘moderation_pending’] )) {
    $topic_url = get_permalink( $_REQUEST[‘moderation_pending’] );
    echo ‘<div class=”mod-return”><h2 style=”color:Tomato;”>Return to topic</h2></div>’;
    }
    }

    just got to work out how to bring up a different page if the post is not saved, dont warry go and have a nice holiday you deserve it.
    I will post the answer when I work it out.

    Regards
    Clive

    #243274
    Robin W
    Moderator

    1. not sure what is the ‘thankyou message’ you get?

    A reply I make just gets accepted and then goes to the reply with the url which is the ID of the reply.

    /forums/topics/testtopic/#post-33905

    so what is adding the ‘thankyou’ message

    2. If it is written to the database it will be in

    dashboard>settings>replies either in all, pending, trash or spam – if it is not there, then it is not in the database.

    3. what have you got set in
    dashboard>settings>bbp style pack>Topic/Reply Form item 16 if checked, try unchecking it or visa versa

    4. and check items 13 and 14 if ticked untick to see if that fixes

    #243272
    Robin W
    Moderator

    Too many variables to be able to help in any generic way.

    You will need to try and work out what makes some work and some not.

    So each time before you post, take a copy of the reply content , note the date and time, and keep doing this for both successful and failed replies. Note also any other people posting around the time that you did.

    When you have got say 20 failed replies, you can start to analyze whether there is any common reason, such as words, length, no. paras, subject matter, time of day etc.

    If that fails, then you could start to think that it is not code related, so maybe hosting platform, eg memory – say 3 people using the site at once.

    #243251
    issobruno
    Participant

    after hours I get this code that works so fine!!

    function bbpress_comentarios_ajax() {
        ?>
        <script type="text/javascript">
            jQuery(document).ready(function($) {
                $('#bbp_reply_submit').click(function(e) {
                    e.preventDefault(); // Impede o recarregamento normal
    
                    var form = $(this).closest('form');
                    var formData = form.serialize();
    
                    $.post(form.attr('action'), formData, function(response) {
                        // Recarrega só a área dos comentários
                        $('.bbp-replies').load(window.location.href + ' .bbp-replies > *');
                        form[0].reset(); // Limpa o campo de resposta
                    });
    
                });
            });
        </script>
        <?php
    }
    add_action('wp_footer', 'bbpress_comentarios_ajax');

    enjoy 🙂

    #243246

    @robin-w, FYI, the main code which provides the compatibility can be found in includes/Compatibility.php file.

    #243245

    Hi @robin-w,

    Feel free to study the code at https://github.com/webmandesign/bbp-block-theme

    Thank you for your fix via your bbp style pack plugin. As far as I understand, your plugin also provides means to style bbPress plugin. In my plugin this is not an option – it really just enables bbPress for block themes.

    For how the plugin actually works check the info in readme.txt file.

    #243244
    Robin W
    Moderator

    Interesting – my style pack plugin has a fix for block themes, but from very little knowledge of FSE. I’m away for the next few weeks, but will be interesting to take a look at the code you have done.

    #243225
    Robin W
    Moderator

    pretty sure that it is LearnPress – bbPress Integration

    We have submitted a change required to Learndash.

    If you are into code the fix is in learndash-bbpress\includes\class-dependency-check.php line 119 – the line needs changing from

    $plugin_header = get_plugin_data( trailingslashit( str_replace( '\\', '/', WP_PLUGIN_DIR ) ) . $plugin_key );
    to

    $plugin_header = get_plugin_data( trailingslashit( str_replace( '\\', '/', WP_PLUGIN_DIR ) ) . $plugin_key, false, false );

    This then prevents translations being loaded at that point (too early) and hopefully fixes the issue.

    #243142
    painlessseo
    Participant

    Hi @akira010203, I’m fairly new to bbpress and I don’t understand why we need to use Settings -> Discussion -> Comment Moderation to allow links in bbpress Replies.

    Isn’t that setting for Comments?

    I have some users/participants whose replies will go straight to pending if they post ONE link despite that I set ‘Hold a comment in the queue if it contains 2 or more links’.

    How does the anti spam code logic work in bbpress? I’m quite confused.

    Your input will be greatly appreciated!

    #243133
    Robin W
    Moderator

    users can subscribe to forums and topics, both work the same way. The post ID is either a forum or topic.

    Not suer what you mean by command – if sql then I cannot help you. If php then you would use get_users and loop through that and use

    bbp_add_user_subscription( $user_id, $forum_id )

    private groups – the code simply checks matches. Users have a user_meta entry of ‘private_group’ and forums have a post_meta of ‘_private_group’ the general settings are stored in the options table

    Robin W
    Moderator

    The following hooks are the nearest to what you want

    do_action( 'bbp_template_before_replies_loop' ); ?>
    
    do_action( 'bbp_template_before_forums_loop' ); ?>
    
    do_action( 'bbp_template_before_topics_loop' ); ?>
    
    #243111
    Robin W
    Moderator

    forum subscribed users are held in post_meta database for the forum

    so if the forum is ID 2927, then in post_meta you would have an entry for each subscribed user eg

    `

    post_id		meta_key			Meta_value
    2927		_bbp_subscription 	1371
    2927 		_bbp_subscription 	1372

    would mean that user_ID’s 1371 and 1372 are subscribed to forum 2927

    #243079
    manojmohandev
    Participant

    Looks like it was fixed way back when codebase was not modularized to this extent. Here is the ticket that was closed some 13 years back with commit that fixes it.

    If you observe these check doesn’t exist anymore before updating last reply id and all.

     // Update if reply is published
            if ( bbp_is_reply_published( $reply_id ) )
                    update_post_meta( $topic_id, '_bbp_last_reply_id', (int) $reply_id );
    
    #243076

    In reply to: Private messages

    Here are a few options:

    bbPress Messages: This plugin offers a simple yet powerful private messaging system tailored specifically for bbPress. It includes features like message caching for faster performance, background processing for tasks such as email notifications, and support for shortcodes and widgets.
    JA.WORDPRESS.ORG

    Better Messages: A comprehensive real-time private messaging system compatible with bbPress, BuddyPress, and other WordPress platforms. It provides features like live chat, file uploads, emoji support, message editing and deleting, and even audio and video calls.
    JA.WORDPRESS.ORG

    bbPress – Private Replies: This plugin allows forum participants to mark their replies as private, meaning only the original poster and forum moderators can view the content. It’s particularly useful for support forums where users may need to share confidential information.

    #243074
    swinggraphics
    Participant

    On the Topics archive page, the pagination links are broken, going to a forum. This appears to be due to maybe_map_permalink_to_group(). My solution is to add a filter after BBP_Forums_Group_Extension->topic_pagination() to correct the base parameter:

    
    /* Fix BBPress pagination */
    function my_topic_pagination_fix( $r ) {
    	if ( is_post_type_archive( 'topic' ) ) {
    		$r['base'] = bbp_get_topics_pagination_base();
    	}
    	return $r;
    }
    add_filter( 'bbp_topic_pagination', 'my_topic_pagination_fix', 11 );
    
    
    #243072
    Robin W
    Moderator

    the code above provides a fix.

    without knowing what your code does, impossible to provide a hook

    #243069
    manojmohandev
    Participant

    Even I am facing this issue. Ideally they should not update reply count or any other metrics if the reply or topic is form. I have found a way to tweak the codebase and do it but I want the plugin developer to provide some hook for it.

    #243024
    marbaque
    Participant

    I am receiving this php notice:

    Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the bbpress domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later.

    I am running Version 2.6.11

    #242917
    Joakim Nömell
    Participant

    Hello. I run a site where I use the theme Blog FSE. BBPress does not work with this theme. It works fine with Twentysixteen, for example. Is there any way to solve this so that BBPress can work with Blog FSE so I don’t have to change themes? My knowledge of PHP is low and I have a visual impairment and therefore it is quite difficult to work too much in PHP code.

    Latest WordPress and BBPress versions.

    #242849

    In reply to: This forum is empty

    Robin W
    Moderator

    To do this without code install

    bbp style pack

    once activated go to

    dashboard>settings>bbp style pack>Forums Index Styling item 16

    or with the code above use

    Code Snippets

Viewing 25 results - 1 through 25 (of 32,358 total)
Skip to toolbar