Skip to:
Content
Pages
Categories
Search
Top
Bottom

Set default forum when creating new topics in bbPress


  • elpju
    Participant

    @elpju

    As the title says, is it possible to select a default forum that is set when people create a new topic? The thing is I only have ONE forum and it’s just crazy that people have to choose it before being able to post.

    Right now the default choice is (No Forum) and when you click Submit with No Forum posted, you get this: ERROR: Forum ID is missing.

    Hope some bright mind comes along and sees this post.

Viewing 18 replies - 1 through 18 (of 18 total)

  • Unit9
    Participant

    @unit9

    I’d like this too. For some reason there was a default in my previous bbpress site, but in the latest installation, I have ‘No Forum’ selected.

    Any way we can change this?


    elpju
    Participant

    @elpju

    This is exactly what I’m talking about. I also remember having a default forum in a previous version of the bbPress plugin, but this may just be wishful thinking.


    Unit9
    Participant

    @unit9

    Yep – I’ve just installed an old version of BBPress and it’s working – I’ve got a default forum again.

    It’s also fixed the bug where page meta titles don’t work on WordPress blog posts.


    elpju
    Participant

    @elpju

    I told them about those titles a month ago and thought it would have been fixed by now. It’s a pretty serious problem if you rely on traffic from the search engines.

    [bbp-topic-form forum_id=$forum_id] – Display the ‘New Topic Form’ for a specific forum ID
    https://codex.bbpress.org/shortcodes/

    So if the forum you want has an ID of 341 use [bbp-topic-form forum_id=341]


    hotconductor
    Participant

    @hotconductor

    Right Stephen, but that doesn’t change the default form that gets embedded on each forum index page.


    Robkk
    Moderator

    @robkk

    @hotconductor

    Thats just a shortcode that you put in a separate page, not the topic form being displayed below forums using the form-topic.php template.


    hotconductor
    Participant

    @hotconductor

    Right. I am curious, like the original poster, about setting a default forum instead of having (no forum) as the default. People compose posts, without selecting a forum… it kicks back an error, no one gets it. I’d rather have it set by default to a general category, and the dropdown is there for seasoned users. Makes no sense that it is set as (no forum) by default, especially for folks who only have a single forum.

    Is there a way to change the default from (no forum) to forum1/etc?


    Robkk
    Moderator

    @robkk

    For having a forum show up instead of the (No Forum), copy form-topic.php in your child theme.

    In the code toward line 109 you would see something like this.

    <?php if ( !bbp_is_single_forum() ) : ?>
    
     <?php do_action( 'bbp_theme_before_topic_form_forum' ); ?>
    
    	<p>
    		<label for="bbp_forum_id"><?php _e( 'Forum:', 'bbpress' ); ?></label><br />
    			<?php
    				bbp_dropdown( array(
    				'show_none' => __( '(No Forum)', 'bbpress' ),
    				'selected'  => bbp_get_form_topic_forum()
    				) );
    			?>
    	</p>
    
    <?php do_action( 'bbp_theme_after_topic_form_forum' ); ?>
    
    <?php endif; ?>

    Remove 'show_none' => __( '(No Forum)', 'bbpress' ), so it would look like this.

    <?php if ( !bbp_is_single_forum() ) : ?>
    
     <?php do_action( 'bbp_theme_before_topic_form_forum' ); ?>
    
    	<p>
    		<label for="bbp_forum_id"><?php _e( 'Forum:', 'bbpress' ); ?></label><br />
    			<?php
    				bbp_dropdown( array(
    				'selected'  => bbp_get_form_topic_forum()
    				) );
    			?>
    	</p>
    
    <?php do_action( 'bbp_theme_after_topic_form_forum' ); ?>
    
    <?php endif; ?>

    The default forum shown is whatever is first in the forum index page. It either is sorted by publish date first or the forum ordered first if you manually changed the forum order by editing the forum.


    JijOnline
    Participant

    @jijonline

    Awesome! Thnx!


    gyupe
    Participant

    @gyupe

    HI,i need to have a possibility to select which forum i want reply with a dropdown list.
    Can u help me?


    chezsheles
    Participant

    @chezsheles

    Hi – The solution offered by robkk creates a white screen (o’ death) on the front end and then this error in the debug_log:

    [18-Mar-2019 17:13:21 UTC] PHP Parse error: syntax error, unexpected '<', expecting end of file in .../wp-content/themes/MyStupidTheme/functions.php on line 63

    Line 63 in my child functions file is the first line of code:

    <?php if ( !bbp_is_single_forum() ) : ?>

    I used php code checker to see whether or not the code was still valid, and it checked out ok.

    I even cut and pasted the code from this page to Text Wrangler, to strip it of any errant styling or whatnot before I pasted it into my child theme. Still get the same error and white screen.

    What else might I try?

    Thanks much for any help!


    chezsheles
    Participant

    @chezsheles

    oops – I mean the code in my child theme functions. Just so it’s clear. I’m using a child theme and have added the code to the child theme functions.


    Robin W
    Moderator

    @robin-w

    can you post lines 60-65 here please


    hrithik951
    Participant

    @hitesh4317

    Any update???


    Robin W
    Moderator

    @robin-w

    refresh my memory, when does this come up ?

    I don’t see a default form in my forums list


    hrithik951
    Participant

    @hitesh4317

    When using this shortcode- [bbp-topic-form]

    It’s working.

    There are total 3 files named form-topic.php you would have to remove it from all three to remove (default forum). One is in the Bbpress plugin, other in the theme and one somewhere else (use Search function). It’s on line 128 in all three files if memory serves right.


    Robin W
    Moderator

    @robin-w

    ok, so the threads above have one poster asking about having this as a single forum, and another about not having ‘no forum’

    what are you wishing to achieve?

Viewing 18 replies - 1 through 18 (of 18 total)
  • You must be logged in to reply to this topic.
Skip to toolbar