bjorn2run (@bjorn2run)

Forum Replies Created

Viewing 1 replies (of 1 total)

  • bjorn2run
    Participant

    @bjorn2run

    I was running into the same issue, here’s what I did:
    I copied:
    /wp-content/plugins/bbpress/templates/default/bbpress/form-topic.php
    into the root of my theme folder:
    /wp-content/themes/(YourTheme)/form-topic.php

    I renamed the file to:
    form-topic-home.php

    so I can call it separately and makes changes to it without having an impact on the normal add topic form.

    In my new file I removed the if statements for testing if the page is a single forum or a topic edit, my form is going into a modal on my homepage, so neither of those will ever be necessary.

    Starting at line 12 I deleted this:

    <?php if ( !bbp_is_single_forum() ) : ?>
    
    <div id="bbpress-forums">
    
    	<?php bbp_breadcrumb(); ?>
    
    <?php endif; ?>
    
    <?php if ( bbp_is_topic_edit() ) : ?>
    
    	<?php bbp_topic_tag_list( bbp_get_topic_id() ); ?>
    
    	<?php bbp_single_topic_description( array( 'topic_id' => bbp_get_topic_id() ) ); ?>
    
    <?php endif; ?>

    Next on what was line 28 I changed
    <?php if ( bbp_current_user_can_access_create_topic_form() ) : ?>
    to
    <?php if ( bbp_current_user_can_publish_topics() ) : ?>

    The original code does a lot of checking if the user can edit forums, if we’re on a single page or if this is one off page, we’re really only looking for the current user’s ability to post topics, and we’re given that (inside that same function actually)

    At the very bottom of the file you’ll also want to delete this:

    <?php if ( !bbp_is_single_forum() ) : ?>
    
    </div>
    
    <?php endif; ?>

    as it’s the closing div tag to the stuff we cut out at the top of the file.

    Now where you were going to use the short code, call a template part instead, and you should be square.

    <?php bbp_get_template_part( 'form', 'topic-home' ); ?>

Viewing 1 replies (of 1 total)