Skip to:
Content
Pages
Categories
Search
Top
Bottom

New Topic Form Shortcode Issue


  • ThePopularizer
    Member

    @thepopularizer

    I’m trying to implement a “Quick Post” box using the New Topic Form shortcode, [bbp-topic-form], but it seems non-admin users cannot post using the form (it says, “You cannot create new topics at this time.”). The same users can post a topic by actually going into the forums, so I’m wondering what the issue might be.

    The website URL: capital.businesses.org.nz

    It’s a subdomain installation of a multi-site network (businesses.org.nz), which in turn is part of a multi-network installation (using the ‘networks for wordpress’ plugin).

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

  • N3RI
    Participant

    @n3ri

    I have the same problem.


    Ben
    Participant

    @communicatorsinaction

    Have you found a solution to this problem?

    I’m having the same issue. I used the [bbp-topic-form] shortcode in my `bbpress.php` template file. If I enter with my super-admin account I can see the form and create topics. But if I enter under the default “Participant” role, it gives me the message “You cannot create new topics.” However, if I go to a specific forum, the topic form is displayed underneath, so it must be a shortcode problem.

    Right now I’m using `echo do_shortcode(“[bbp-topic-form]“);` to include the form in my template file. Is there a better way to do this?


    Ben
    Participant

    @communicatorsinaction

    Okay, that’s just weird.

    I created a separate page for topic creation and just ran the same PHP call (`echo do_shortcode(‘[bbp-topic-form]‘);`), and it works… So for some reason that call doesn’t behave properly in my `bbpress.php`, but does just fine in a custom template.


    allenmccabe
    Participant

    @allenmccabe

    I am having this same issue; I created a “partner” page for /forums/ and put in the `bbp-topic-index` as well as the `bbp-topic-form`, but only admin users can use the create new topic form.

    I tried creating a custom template for this page like Ben tried, but the “echo shortchode” call does nothing.

    We need users a way to add new topics quickly and easily, without having to drill down to the one and only forum.


    allenmccabe
    Participant

    @allenmccabe

    Just for clarification, I tried the full “do_shortcode” call just as Ben posted:

    `echo do_shortcode(‘[bbp-topic-form]‘);`

    which had no effect.

    Can you create a bug ticket over at trac for this please

    http://bbpress.trac.wordpress.org/


    allenmccabe
    Participant

    @allenmccabe


    sulliwane2
    Participant

    @sulliwane2

    Hello, I have the exact same problem :

    On /forum page I put this bbpress shortcode : [bbp-topic-form]

    And when non-admin user is logged-in, it displays the message “You cannot create new topics.

    Any workaround ?

    Thx


    renai42
    Participant

    @renai42

    hi everyone,

    I didn’t used to have this problem, but upon upgrading to bbPress 2.3.2, it manifested. The [bbp-topic-form] shortcode now no longer allows un-privileged users to post. Seems like this bug hasn’t been fixed.

    Is there any update to this situation?

    Kind regards,

    Renai


    Laughing Cat
    Participant

    @laughing-cat

    +1
    I’m having the same issue, it only happens for non-admins on bbpress home archive, where I have latest topics and forum list shortcodes too (which work fine)

    has this issue been solved?


    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' ); ?>


    palmdoc
    Participant

    @palmdoc

    Gosh the fix sounds complicated. I’ll wait for the official bug fix :)


    palmdoc
    Participant

    @palmdoc

    The bug is still there for 2.5.2


    Will Brownsberger
    Participant

    @will-brownsberger

    Definitely wait for the fix.

    The fix suggested by the author above gets past the security problem. And there is another easy work around — use short code with a forum id set. That works.

    However, there are other problems which more serious, which neither approach fixes. The bbp-topic-form short code just doesn’t necessarily work on a front page — it loses context. The field validation works but does not send the user back to the form. The short code seems to work return properly in a widget, but it really seems to bomb if invoked standalone via php on a front page.

    If you are using it in a widget, you may be fine.


    Satrya
    Participant

    @satrya

    I guess the main question here is the [bbp-topic-form] not work if you place the shortcode on your main forum/forum archive. This is because the form uses bbp_current_user_can_access_create_topic_form function to check several condition and the most important you need to know is it ONLY allow the form displayed on single page/forum.

    Here’s my simple solution, place it in your functions.php

    
    add_filter( 'bbp_current_user_can_access_create_topic_form', 'custom_bbp_access_topic_form' );
    function custom_bbp_access_topic_form( $retval ) {
    
    	if ( bbp_is_forum_archive() ) {
    		$retval = bbp_current_user_can_publish_topics();
    	}
    
    	return $retval;
    
    }
    

    sulliwane2
    Participant

    @sulliwane2

    Yes, thanks a lot it works perfectly! :)


    palmdoc
    Participant

    @palmdoc

    Thank you @satrya. Works perfectly!


    Robin W
    Moderator

    @robin-w

    @satrya

    Looks like you’ve done the research – I have added your comments to the tracticket

    http://bbpress.trac.wordpress.org/ticket/2175

    and we’ll see if the experts reckon that’s the fix and put it in the next release

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

You must be logged in to reply to this topic.