Skip to:
Content

bbPress.org

Opened 7 years ago

Last modified 4 years ago

#2175 new defect

New Topic Form Shortcode Issue

Reported by: allenmccabe Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 2.2.3
Component: API - Shortcodes Keywords: needs-testing
Cc: pericam@…, pascal.casier@…

Description

"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." - original thread author

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 but

echo do_shortcode('[bbp-topic-form]');

does nothing.

Change History (16)

#1 @johnjamesjacoby
7 years ago

  • Keywords needs-testing added
  • Milestone changed from Awaiting Review to Future Release

This works fine for me on trunk, and is what we use on bbpress.org and buddypress.org.

Anyone else care to test?

#2 @allenmccabe
7 years ago

@johnjamesjacoby

Just to clarify, did you try loading the page with the bbp-topic-form shortcode as a non-admin user? Was it on a "partner" page (ie. /forums/)?

#3 @apet083
7 years ago

I am getting this issue also with a user on my site.

#4 @earthman100
7 years ago

I have the same problem except I am including the form in php (in content-archive-forum.php) with the following:

<?php bbp_get_template_part( 'bbpress/form', 'topic' ); ?>

When a user with proper posting permissions goes to the Forums archive, the message: "You cannot create new topics." is shown instead of the Form, but when they navigate to a single forum page, the form works fine.

#5 @apet083
7 years ago

I have worked around this by adding a "New Topic" button to my forum page. This links to a new page using the page-create-topic.php file that I got into my template by copying the "extras" folder that sits in the bbPress files, and styled it according to my theme's page templates. The users like this a lot better as it is more obvious as to how to post a new topic.

#6 @johnjamesjacoby
7 years ago

The page here: http://bbpress.org/forums/new-topic/

...is just a WordPress page, with a shortcode in it. Does this work for you? If it does, it's working as expected in /trunk.

I don't quite follow exactly what everyone else is trying to do. Can you give me a step by step to reproduce it from a brand new, unmodified installation.

#7 @apet083
7 years ago

Where I have found problems, is when I have a page for my forum that uses 3 shortcodes:
bbp-topic-index, bbp-topic-form and bbp-forum-index.
The first and last work fine but when a user is logged in with the default role, they cannot post any topics using the bbp-topic-form. There is a notice that says: "You cannot create new topics."
You can view this if you like on www.monarch.org.nz/monarch/forum and registering to see what the users see.
When I have a separate blank page that uses the bbPress template page-create-topic.php and a button that navigates to this page (like the link you gave above) it works fine.

#8 @renai42
6 years ago

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.

#9 @NerdEnPose
6 years ago

I'm using WP 3.5.1 and BBPress 2.3.2

In my loop-topics.php template I'm using this code to create a new topics form.

bbp_get_template_part( 'form', 'topic' );

I haven't modified the template in any other way. I've also disabled all plugins except BBPress. I'm new to BBPress so I haven't tried to track down the issue any further.

#10 @mompracem
6 years ago

Same issue, BBPress 2.3.2, WP 3.5.1

If I place a form topic shortcode on my BBPress forum archive page (where I display two more shortcodes, recent topics and forum list) only the admin users will be able to use the form topic. Subscribers and forum participants will receive the message that they're unallowed to start new topics. The same issue doesn't happen on individual forum pages or topic replies. The same issue occurs if I call directly the form topic template part by php or execute the shortcode in php. It looks like a permission issue rather than shortcode issue.

I've temporarily fixed by moving the shortcode to another page, in which case works. But I really liked the fact users could post a new topic directly from the forum home.

I do not get further php errors or warnings, therefore I can't add much more to this at the moment.

#11 @angslycke
6 years ago

Had same issue. WP 3.7.1, bbPress 2.5.1, BuddyPress 1.8.

Resolved it by changing the forum permalink from "Forums" to something else. Previously I had the permalink "Forums" and a WordPress page with the same URL where I had inserted the shortcodes. Noticed that the shortcodes worked on other pages and figured it might be a conflict with the permalink. Now using just the WordPress page as the main menu link to forums, showing recent active topics.

As previously noted, admins see the bbp-topic-form but not non-admins.

Last edited 6 years ago by angslycke (previous) (diff)

#12 @Robin W
6 years ago

from @satrya :

http://bbpress.org/forums/topic/new-topic-form-shortcode-issue/

I guess the main question here is the [bbp-topic-form] will 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;

}

Suspect @netweb will suggest I crate a patch for this next - which I'll do if someone thinks this is the solution - I'm just posting it as I saw it in the forums and it looks like @satrya has done the research !

#13 @satrya
6 years ago

I dont know this is an issue or not, but the code from me is just for someone who need to display the topic form on main forum.

#14 @mvaneijgen
5 years ago

This is still a issue for me, using the latest version of bbpress and the WP 4.1.1. I have created a custom feedback-no-search.php to show a "Create your own topic, cause it seems no one else has this qeustion" and I want 'normal' users to create there own topcis. If I give the shortcode a ID of a forum everything works fine.

The function @Robin W posted doen not work for me, but that is a year old already.

#15 @Stagger Lee
4 years ago

  • Cc pericam@… added

#16 @casiepa
4 years ago

  • Cc pascal.casier@… added
Note: See TracTickets for help on using tickets.