Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 2,201 through 2,225 (of 32,461 total)
  • Author
    Search Results
  • #215824
    Robin W
    Moderator

    try

    $sub_forums = bbp_forum_get_subforums(90);
    var_dump($sub_forums);
    #215819
    yurius
    Participant

    I want to list the subforums under the category. My forum structure is like this:
    Category A
    – Subforum1
    – Subforum2
    – Subforum3

    When parent category id is ’90’, I expected to get subforums of category 90.

    $sub_forums[] = bbp_forum_get_subforums(90);
    var_dump($sub_forums);

    This returns empty array. Please let me know if my usage is wrong.

    #215795

    In reply to: Post header

    Robin W
    Moderator

    close – means the post still shows, but no-one can add to it
    Trash – means put in trash, so the post is no longer shown
    Unapprove – makes the topic pending – it is not seen in by users, only moderators and keymasters
    sticky – puts the post above ordinary posts in the list – typically to have a topic always at the top

    Keymaster – Can create, edit and delete other users’ forums, topics and replies. Can manage Tags, and moderate a forum with the moderation tools. Has access to global forum settings, tools, and importer.
    Moderator – Can create and edit forums. Can create, edit and delete other users’ topics and replies. Can manage Tags, and moderate a forum with the moderation tools.

    bbPress User Roles and Capabilities

    #215783
    berry metal
    Participant

    Hi again,

    I added this code:

    if ( function_exists( 'bbp_enqueue_script' ) && function_exists( 'bbp_get_version' ) ) {
        bbp_enqueue_script( 'bbpress-engagements', 'js/engagements.js', array( 'jquery' ), bbp_get_version(), true );
    }

    so now it looks like this:

    add_shortcode( 'bbpresscomments', function() {
        $output     = '';
        $current_id = function_exists( 'vcex_get_the_ID' ) ? vcex_get_the_ID() : get_the_ID();
        $topics = new WP_Query( array(
            'post_type' => 'topic',
            'posts_per_page' => -1,
            'fields' => 'ids',
        ) );
        if ( $topics->have_posts() ) {
            // enqueue scripts on this next line...
            if ( function_exists( 'bbp_enqueue_script' ) && function_exists( 'bbp_get_version' ) ) {
        bbp_enqueue_script( 'bbpress-engagements', 'js/engagements.js', array( 'jquery' ), bbp_get_version(), true );
    }
            foreach( $topics->posts as $topic ) {
                if ( get_the_title( $topic ) == get_the_title( $current_id ) ) {
                    $output .= do_shortcode( '[bbp-single-topic id="' . intval( $topic ) . '"]' );
                }
            }
        }
        return $output;
    } );

    because I can see that code that enables all functionality including AJAX, is only enqueued for bbPress pages:

    https://github.com/bbpress/bbPress/blob/afa6030c3e27c4fe582743074a603d25b5e4de48/src/templates/default/bbpress-functions.php#L151

    And it’s not enabled for bbPress shortcodes.

    Is this right?

    Could you please tell me what is wrong with my code, and why cannot I enqueue the scripts that will enable AJAX for the shortcodes?

    Instead of proper enqueuing, my code makes the buttons not work at all, when I click on them, nothing happens.

    #215780
    Adam
    Participant

    Looking in the browser developer tools, I think I can see what is happening. The problem is:

    #bbpress-forums {
        background: 0 0;
        clear: both;
        margin-bottom: 20px;
        overflow: hidden;
        font-size: 12px; 
        line-height: 18px;

    and then there’s also .bbp-breadcrumb and .bbp-template-notice and so on.

    And then there’s this CSS class defining the width inside the standard WP entry-content:

    .entry-content > *:not(.alignwide):not(.alignfull):not(.alignleft):not(.alignright):not(.is-style-wide) {
        max-width: 57rem;
        width: calc(100% - 4rem);
    }

    What do you recommend as the best way forward, bearing in mind I will probably forget all about this after a couple of months! 😆

    A child theme from Twenty Twenty?

    Or just the appropriate CSS in the WP theme Additional CSS dialog?

    #215773
    yurius
    Participant

    When I input terms to the search form, it redirect to index.php.
    <?php bbp_get_template_part( 'form', 'search' ); ?>

    I went through troubleshooting here and changed search slag to ‘find’ but it couldn’t resolve.

    Search Redirects to Front Page


    I also tried common troubleshooting here: https://codex.bbpress.org/getting-started/troubleshooting/
    Nothing changed.

    It seems my customized theme causing an issue because it worked when I switched to the default ‘Twenty Nineteen’ theme it worked.
    But I have no idea which part is causing the issue. Can somebody help?

    #215769
    Adam
    Participant

    Hi,
    I’m struggling to set up bbPress so that the forum style adheres to the website style.

    I wasn’t able to find the right place to change the font size on this page linked to above despite your guidance 🙁

    I’m trying to read my way through the bbPresss documentation in codex.bbpress.org but it starts off getting right into the nitty-gritty by recommending I create a child theme and start writing CSS.

    I’m using Twenty Twenty theme for the main site. I read that I might need to create a bbPress theme – but I think I need to read a lot more about that.

    Any help gratefully received!

    #215745
    Robin W
    Moderator
    add_action ('bbp_template_before_single_forum' , 'rew_add_html' ) ;
    
    function rew_add_html () {
    	echo '<b>hello</b>';
    }

    and amend echo '<b>hello</b>'; to what you want

    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

    #215744
    RedTravelMaster
    Participant

    Hello,

    I’d like to be able to add some custom html code to my forum pages, under the forum title and breadcrumbs, but before the first forum topic. How would I go about doing this?

    Thank you for any assistance.

    Ron

    #215740
    berry metal
    Participant

    The reason is hard for me to debug this issue is that I am using this code to output a bbpress topic under each post that has the same name as the current post title:

    add_shortcode( 'bbpresscomments', function() {
        $output     = '';
        $current_id = function_exists( 'vcex_get_the_ID' ) ? vcex_get_the_ID() : get_the_ID();
        $topics = new WP_Query( array(
            'post_type' => 'topic',
            'posts_per_page' => -1,
            'fields' => 'ids',
        ) );
        if ( $topics->have_posts() ) {
            foreach( $topics->posts as $topic ) {
                if ( get_the_title( $topic ) == get_the_title( $current_id ) ) {
                    $output .= do_shortcode( '[bbp-single-topic id="' . intval( $topic ) . '"]' );
                }
            }
        }
        return $output;
    } );

    This code is theme specific, so testing with an other theme doesn’t make sense in this case.
    I will open now a ticket to my theme developer, but if you can see anything in this code that would make AJAX not work, please let me know.

    Thanks.

    #215708
    samtime
    Participant

    Okay, got the following solution from a friend and it seems to work!
    Posting the updated code here incase others have the same problem:

    add_filter('woocommerce_disable_admin_bar', '_wc_disable_admin_bar', 10, 1);
     
    function _wc_disable_admin_bar($prevent_admin_access) {
        if (!current_user_can("keymaster") && !current_user_can("bbp_moderator") ) {
            return $prevent_admin_access;
        }
        return false;
    }
    #215680
    Robin W
    Moderator

    dashboard>settings>bbp stylepack> forums index styling and just change all tne font sizes to what you want

    or

    bbPress Styling Crib

    jveld
    Participant

    Dear all,

    Since a couple of months I am using a BBpress forum (and BBpress Attachments) on my WordPress (5.5.3) page (TopMag 2.0.2 theme) related to http://www.amrwr.nl

    I’ve got a very strange thing going on: everytime I (or a different user) start(s) a new thread and insert a Youtube or blogspot link, a download is prompted (a pop-up with ‘open’ or ‘save as’ appears) and the message itself is not posted.

    When I then open the downloaded file, the following code is displayed:

    <!DOCTYPE HTML PUBLIC “-//IETF//DTD HTML 2.0//EN”>
    <html><head>
    <title>503 Service Unavailable</title>
    </head><body>
    <h1>Service Unavailable</h1>
    <p>The server is temporarily unable to service your
    request due to maintenance downtime or capacity
    problems. Please try again later.</p>
    </body></html>

    This currently happens in the following browsers: Mozilla Firefox, IE, Edge, Chrome, DuckDuckGo. Untill very recently, IE and Firefox did not have this problem…

    I have done all the troubleshooting I could (given the knowledge I have) and are now quite lost as to how to solve this problem.

    Any help would be much appreciated!

    Regards,

    Jascha

    #215573
    Stephen
    Participant

    Hi there All,
    I have enabled new registrations, by creating a registration page. and use the shortcode [bbp-register].

    however, when I test this in incognito, I do received the email to complete my registration but it only contains

    Username: john###
    Email: john###@gmail.com

    is there ment to be a password, or a link to create a password?

    WordPress 5.5.1
    bbPress 2.6.5

    #215556
    Robin W
    Moderator

    How can I solve this without adding custom code somewhere or adding more plugins for minor issues like this?

    you can’t without doing one of the two. Given that every page rendition of a site without caching involves the parsing of many thousands of functions, and execution of several thousand, adding a plugin or some code to so this will add no perceivable delay to your site.

    plugin wise

    bbp style pack

    code wise

    https://codex.bbpress.org/layout-and-functionality-examples-you-can-use/#4-turning-off-or-changing-breadcrumbs item 4 to turn off homepage

    #215555
    cashcreatorsclub
    Participant

    Hi,

    The breadcrumb shows the title of the homepage instead of Home. How can I solve this without adding custom code somewhere or adding more plugins for minor issues like this?

    I use elementor pro as a theme framework.

    Thanks.

    Greetings

    #215553
    Robin W
    Moderator
    add_action( 'bbp_template_after_single_topic' , 'rew_add_shortcode2'); 
    
    function rew_add_shortcode2 () {
    	echo do_shortcode( '[shortcode here]' );
    }
    #215552
    truth4vahid
    Participant

    I want put a html code under the reply form like the area shown in the picture. Could you give me such a code?
    area

    #215535
    AndyHenderson
    Participant

    Thanks for spotting that. I’d assumed it was something I had done to disrupt BBPress but I hadn’t spotted the page was being refreshed and that it cleared the Javascript error from the console.

    Until the issue is fixed, a better work-around is to add a filter to functions.php rather than modify the BBPress code directly. That way the fix should survive a BBPress update. I used…

    // Prevent reply button in forums from executing a refresh of the page
    add_filter('bbp_get_reply_to_link', 'ctcFixReplyToLink', 10, 3);
      function ctcFixReplyToLink( $link, $r, $args ) {
        return str_ireplace( '"return addReply', '"event.preventDefault(); return addReply', $link );
      }
    #215532
    dasr94
    Participant

    i have a website with elementor, astra, learndasg and bbpress, when i do a new replie from a topic i dont have problem that show the replie like a thread but in a other page that have inserted the topic with shortcode i dont add a new replies like a thread, appears like a new replie, i can show images if you want

    mkbond
    Participant

    Hello, there!

    We work with BuddyBoss but with a primary focus on forums/topics with bbPress.

    So I’m having issues with the hierarchy of forums and discussions and… I’m trying to have a page for each forum — with all of the discussions listed as a post grid (not BuddyBoss’ Forum Grids, need this to vary from page to page). So with regards to taxonomy and filters, I want to have the parent category defined as a particular forum, and the children categories to be the discussion within that same forum. Example: Need different pages for Recipes, and need a page for Desserts (forum) that shows all the different desserts (discussions/topics), not showing all the other forums (Desserts, Main Dishes, etc.) and their discussions (turkey, asparagus, etc).

    I’ve been playing with Beaver Builder and Gutenberg blocks, but it seems that some plugins have issues reading Custom Post Types, which is what forums and discussions/topics are. And the ones that can, like Beaver Builder, will only let you show the Post Type as Forums, and then you can filter to what forums you want to show, but if you only pick one, then it’s just one lone block. And if I set the Post Type to Discussions, then I have to list each discussion, one by one to display on the page (so each time someone creates a new topic/discussion, it would have to be added to this list).

    We are currently using Beaver Builder but I’m definitely open to other ideas for this. Here’s the Beaver Builder post I made if any of you are familiar with it: Standard Posts Module to Display Category’s Sub-Categories (Child)

    Any ideas or methodologies? I have a web app dev background and am not afraid to modify the functions.php or other files on the backend. See below for what I attempted based on Beaver Builder’s documentation. The second argument for ‘post_parent’ didn’t take, but the post_type did, if I’m not mistaken… leadershipx being the id for the Posts module, but I’ve been looking into wp_query as well (never coded anything yet with wp_query, but happy to learn).

    function fl_builder_loop_query_args_filter( $query_args ) {
      if ( 'leadershipx' == $query_args['settings']->id ) {
        $query_args['post_type'] = array( 'topic' );
        $query_args['post_parent'] = array( '4773' );
      }
      return $query_args;
    }
    add_filter( 'fl_builder_loop_query_args', 'fl_builder_loop_query_args_filter' );

    WordPress v5.5.1, BuddyBoss v1.5.3 (I don’t know where to find bbPress version inside BuddyBoss, but we have the most up-to-date version of BuddyBoss, so I would assume it’s the most recent version of bbPress)

    Site: https://www.mycionetwork.com/

    #215485
    Robin W
    Moderator

    just tried that code on my test site and it works fine.

    where are you putting it ?

    #215482
    Robin W
    Moderator

    ok, try this

    add_filter( 'bbp_before_has_search_results_parse_args' , 'my_bbp_filter_search_results' );
    
    function my_bbp_filter_search_results( $args ){
        $forum_id = 1715;
    
        if( $forum_id && is_numeric( $forum_id ) ){
     
           $args['post_parent'] = $forum_id ;
        }
    
        error_log('Dedicated forum = ' . $forum_id);
     
        return $args;
    }
    
    #215479
    talbotp
    Participant

    Hey Robin, Thanks for the reply, really appreciate it. I added this to my themes functions.php (from the article above), but hardcoded in a forum_id, just to test it out, and it doesn’t seem to work.

    
    function my_bbp_filter_search_results( $r ){
        $forum_id = 1715;
    
        if( $forum_id && is_numeric( $forum_id ) ){
     
            $r['meta_query'] = array(
                array(
                    'key' => '_bbp_forum_id',
                    'value' => $forum_id,    // 1715 x , 11 , 1717 , 
                    'compare' => '=',
                )
            );
             
        }
    
        error_log('Dedicated forum = ' . $forum_id);
     
        return $r;
    }
    add_filter( 'bbp_after_has_search_results_parse_args' , 'my_bbp_filter_search_results' );
    

    the error log is coming through when the page is loaded, but i’m still getting discussions from other forums in the search results.

    #215472
    Robin W
    Moderator

    from a very quick look, that code looks like it should work, and not seen anything else that does this, so try it, and if it doesn’t work, come back

Viewing 25 results - 2,201 through 2,225 (of 32,461 total)
Skip to toolbar