Skip to:
Content

Opened 7 years ago

Closed 6 years ago

Last modified 6 years ago

#1649 closed enhancement (fixed)

‘new topic’ shortcode for a specific forum

Reported by: Sadr Owned by: johnjamesjacoby
Milestone: 2.4 Priority: normal
Severity: normal Version:
Component: API - Shortcodes Keywords: has-patch needs-testing
Cc: stephen@…, e.soghe@…, navjotjsingh@…, jared@…

Description

Original discussion here:
http://devpress.com/forums/topics/better-discussion-for-theme-pages/#post-4033

Simply put, there should be a shortcode like [bbp-reply-form id=$forum_id] to point a reply form to a specific forum ID. Useful for accompanying individual forums embedded in pages, and for instance feedback widgets for users to post to your support forum from anywhere on your website.

Attachments (6)

1649.1.diff (5.5 KB) - added by netweb 6 years ago.
1649.2.diff (1.9 KB) - added by gautamgupta 6 years ago.
A bit hacky (but doesn't have any side effects) and implements forum_id attribute within the existing function
common-shortcodes.patch (1.0 KB) - added by alex-ye 6 years ago.
common-template-tags.patch (710 bytes) - added by alex-ye 6 years ago.
form-topic.patch (817 bytes) - added by alex-ye 6 years ago.
topics-template-tags.patch (3.8 KB) - added by alex-ye 6 years ago.

Download all attachments as: .zip

Change History (23)

#1 @johnjamesjacoby
7 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 2.1
  • Version 2.0 deleted

Replies aren't for forums, they are for topics. Do you mean the topic form?

#2 @Sadr
7 years ago

Oh, right you are sir. Yep, topic form.

#3 @johnjamesjacoby
7 years ago

  • Milestone changed from 2.1 to Future Release

Punting to Future Release to trim down scope for a sooner 2.1.

Should be a pretty easy patch if anyone wants to help out with it.

#4 @netweb
7 years ago

  • Cc stephen@… added

#5 @Sadr
7 years ago

Would love for this to be reconsidered for 2.2

@netweb
6 years ago

#6 @netweb
6 years ago

My first shot at this.... 1649.1.diff

Shortcode: [bbp-topic-in-forum id=$forum_id] eg. [bbp-topic-in-forum id=32]

The gaping hole in this patch is that the 'select forum' dropdown is still shown, I think I have the rest of whats needed for the shortcode though.

Just needs work on parsing $forum_id to form-topic.php template part and to not show bbp_dropdown.

This equates to NOT addressing the specific issue of this ticket, yet, I'll take another stab at this soon.

#7 @netweb
6 years ago

If I call the form-topic.php template for the shorcode

bbp_get_template_part( 'form', 'topic' );

We still get the forum dropdown (the goal of this shortcode is to parse it with $atrr ID) becasue of

if ( !bbp_is_single_forum() ) form-topic.php#120

If I call the content-single-forum.php template for the shorcode

bbp_get_template_part( 'content', 'single-forum' );

We also get the forums loop of sub forums and topics and the forum dropdown

Next steps??? ... A new template part based on content-single-forum.php for this shortcode and some more if/else logic in form-topic.php#120... Not sure... Need to think about this some more :P

#8 @Sadr
6 years ago

  • Cc e.soghe@… added

Not for 2.3 then I guess? Might as well mention that a "post with specific tag" shortcode like [bbp-reply-form id=$tag_id] would also be mighty useful.

Thanks a lot for giving it some attention!

@gautamgupta
6 years ago

A bit hacky (but doesn't have any side effects) and implements forum_id attribute within the existing function

#9 @gautamgupta
6 years ago

  • Keywords has-patch needs-testing added; needs-patch removed
  • Milestone changed from Future Release to 2.4

Attached another patch which makes use of query names to tell bbPress not to display the dropdown. It is also implemented within the bbp-topic-form shortcode and a particular forum can be triggered by forum_id=xx attribute.

Can go into 2.4 or even 2.3.

#10 @netweb
6 years ago

  • Milestone changed from 2.4 to 2.3

Patch works for me

#11 @johnjamesjacoby
6 years ago

  • Milestone changed from 2.3 to 2.4

Would rather not rush a new feature into 2.3 when already in beta. Moving to 2.4.

#12 @navjotjsingh
6 years ago

  • Cc navjotjsingh@… added

#13 @jaredatch
6 years ago

  • Cc jared@… added

@alex-ye
6 years ago

#14 @alex-ye
6 years ago

Uploaded simple patches of how I think this should work. What's your opinion ?

#15 @alex-ye
6 years ago

I am not sure about the purpose of this any-more, I mean bbPress need an API to deal with pre-defined form values.. It's something take time and need a disscussion, I am not talking about the topic-from only but about how all bbPress forms work..

It will be nice feature but I think it need something better than a temp hack !

#16 @johnjamesjacoby
6 years ago

  • Owner set to johnjamesjacoby
  • Resolution set to fixed
  • Status changed from new to closed

In 5012:

Allow topic form shortcode to accept a forum_id attribute. Props netweb, GautamGupta. Fixes #1649.

#17 @johnjamesjacoby
6 years ago

In 5020:

Attributes are optional in the display_topic_form() shortcode. Suppresses debug notice when no attribute is passed, introduced in r5012. See #1649.

Note: See TracTickets for help on using tickets.