Skip to:
Content

bbPress.org

Opened 11 years ago

Last modified 10 years ago

#2449 new idea

bbPress Recent Replies - make a unique option

Reported by: zilveer's profile zilveer Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 2.4
Component: API - Widgets Keywords: needs-ui
Cc:

Description

Hello guys,
I loev bbPress and what you do guys.
But there is something missing in the widget option for recent replies.

If users makes a reply to the same topic, then the same topic name will appear on the recent replies. I want an option on the widget to only show the latest reply (only 1 reply) from the topics.

For example if the recent reply widget shows this:

Recent Replies Widget

Hello world
Hello world
Hello world
Second world
Just testing
Just testing
Nice site

then I want the following instead when the unique option is checked for the widget:

Recent Replies Widget

Hello world
Second world
Just testing
Nice site

Anyway, I have, by looking at the widgets.php file changed the code between the <ul> and </ul> tags, line 1144 to 1195
to the following:

			<?php 
				// Variable for only displaying unique ID's
				$i_unique = '';
			while ( $widget_query->have_posts() ) : $widget_query->the_post(); 
			
			?>

				<li>

					<?php
					// Verify the reply ID
					$reply_id   = bbp_get_reply_id( $widget_query->post->ID );
					$reply_topic = bbp_get_reply_topic_title( $reply_id );
						
					if ($i_unique != $reply_topic): 

						$reply_link = '<a class="bbp-reply-topic-title" href="' . esc_url( bbp_get_reply_url( $reply_id ) ) . '" title="' . esc_attr( bbp_get_reply_excerpt( $reply_id, 50 ) ) . '">' . $reply_topic . '</a>';

						// Only query user if showing them
						if ( 'on' === $settings['show_user'] ) :
							$author_link = bbp_get_reply_author_link( array( 'post_id' => $reply_id, 'type' => 'both', 'size' => 14 ) );
						else :
							$author_link = false;
						endif;

						// Reply author, link, and timestamp
						if ( ( 'on' === $settings['show_date'] ) && !empty( $author_link ) ) :

							// translators: 1: reply author, 2: reply link, 3: reply timestamp
							printf( _x( '%1$s on %2$s %3$s', 'widgets', 'bbpress' ), $author_link, $reply_link, '<div>' . bbp_get_time_since( get_the_time( 'U' ) ) . '</div>' );

						// Reply link and timestamp
						elseif ( 'on' === $settings['show_date'] ) :

							// translators: 1: reply link, 2: reply timestamp
							printf( _x( '%1$s %2$s',         'widgets', 'bbpress' ), $reply_link,  '<div>' . bbp_get_time_since( get_the_time( 'U' ) ) . '</div>'              );

						// Reply author and title
						elseif ( !empty( $author_link ) ) :

							// translators: 1: reply author, 2: reply link
							printf( _x( '%1$s on %2$s',      'widgets', 'bbpress' ), $author_link, $reply_link                                                                 );

						// Only the reply title
						else :

							// translators: 1: reply link
							printf( _x( '%1$s',              'widgets', 'bbpress' ), $reply_link                                                                               );

						endif;
					endif;

					?>

				</li>

			<?php 
				$i_unique = $reply_topic;
				
			endwhile; ?>

And it worked very good. But perhaps you guys maybe can make this as an option instead for the widget? So those who wants to display the unique topic replies have an option.

regards

Change History (7)

#1 @zilveer
11 years ago

  • Component changed from General to Widgets
  • Keywords needs-ui added
  • Priority changed from high to normal
  • Version changed from 2.4.1 to 2.4

#2 @netweb
11 years ago

  • Milestone changed from 2.4.1 to Awaiting Review

#3 @johnjamesjacoby
11 years ago

  • Milestone changed from Awaiting Review to Future Release

Moving to future release. I could see this being implemented as an option, though I think we could handle it in the query rather than in PHP.

#4 @tharsheblows
11 years ago

Isn't this the Recent Topics widget ordered by freshness? I might be misunderstanding something.

#5 @welshdemon
11 years ago

I tried the code from Zilveer, it made a slight improvement, there are certainly less notifications from the same topic, but hasn't fixed the issue.

I hope that this can be implemented soon. Many of my users rely on the recent replies widget but it is usually flooded with replies on the same topic.

Thanks.

http://robssatellitetv.com

Version 0, edited 11 years ago by welshdemon (next)

#6 @welshdemon
11 years ago

Dont use my site as an example, as I have just changed the widget solution.

I found that by using the Recent Topics widget, ordered by "Topics with recent replies" then this works much more how people would desire and expect. However, the only thing missing from that solution is that the links now point to the start of the topic.

Perhaps a tiny mod to add a link to the most recent reply (small arrow or by clicking on the date) would sort this out and everybody would be happy :)

Sorry to post on 2 trac tickets about this but it seems relevant to both.

https://bbpress.trac.wordpress.org/ticket/1918#comment:20

Regards.

#7 @johnjamesjacoby
10 years ago

  • Type changed from feature request to idea
Note: See TracTickets for help on using tickets.