bbPress

Simple, fast, elegant

bbPress Plugin Browser »

Topics Per Page (0.0.7)

Download

Version: 0.0.7

Other Versions

Last Updated: 2009-8-15

Requires bbPress Version: 0.9 or higher

Compatible up to: 0.9

Author Homepage »

Plugin Homepage »

Donate to this plugin »

Average Rating

5 stars
4 stars
3 stars
2 stars
1 star
(14)

Your Rating

Authors _ck_, mdawaffe

Set custom topic or post count limits for nearly every kind of bbPress page while still calculating direct post links correctly. (now 1.0 compatible).

Now adds the ability to do pagination on the front page with the latest discussions.


  1. box87

    5 stars
    4 stars
    3 stars
    2 stars
    1 star

    Member

    Is it just me or does this plugin eat the bbPress RSS function?
    Overall, I'd say it's a good idea, but it's breaking my forums...

    Posted: 3 years ago #
  2. box87

    5 stars
    4 stars
    3 stars
    2 stars
    1 star

    Member

    Sweet, I read the topic in the forums and removed the whitespace problem. Thanks, it works great! It does what it says :)
    It probably would be a good idea if the problem was fixed though.

    Posted: 3 years ago #
  3. While the idea is good, it laks usabilitiy.

    You still have to manualy change the number and upload the file. You'll have to do this everytime you want to change this. So why use a plugin for this? You can also manualy change this in bbPress and upload it.

    This should be done using the admin page to set the bbpress options. Think this will come standard in future releases....

    Posted: 3 years ago #
  4. Null, the most recent version of this plugin (version 0.8) provides such an interface.

    But to answer your question, you should avoid changing core files so that future upgrades are easy.

    Posted: 3 years ago #
  5. Yeah I know, gonna check this plugin thx mdawaffe

    Posted: 3 years ago #
  6. Looks cool, only the submit button is aligned to the right over here, shouldn´t that be to the left?

    Posted: 3 years ago #
  7. I installed it, but there's not new item in the admin pannel. :-/ So I can't change anything... Any help please?

    Posted: 2 years ago #
  8. _ck_

    5 stars
    4 stars
    3 stars
    2 stars
    1 star

    Moderator

    This does not show anything in the site.php submenus when loaded in 0.8.2.1

    Was there a menu change? I remember this kind of problem in wordpress upgrades too when they tinkered with the menu structures.

    Posted: 2 years ago #
  9. _ck_

    5 stars
    4 stars
    3 stars
    2 stars
    1 star

    Moderator

    Okay here's how to fix this plugin so the menu shows up properly in the admin for any version of BBpress:

    replace this function:

    function ront_page_topics_admin_menu() {
    global $bb_submenu;
    $bb_submenu['site.php'][] = array(__('Front Page Topics'), 'use_keys', 'front_page_topics_admin_page');
    }

    With this one that I hacked up based on SamBauers work:

    function front_page_topics_admin_menu() {
    if (function_exists('bb_admin_add_submenu')) { // Build 794+
    bb_admin_add_submenu(__('Front Page Topics'), 'use_keys', 'front_page_topics_admin_page');
    } else {
    global $bb_submenu;
    $submenu = array(__('Front Page Topics'), 'use_keys', 'front_page_topics_admin_page');
    if (isset($bb_submenu['site.php'])) { // Build 740-793
    $bb_submenu['site.php'][] = $submenu;
    } else { // Build 277-739
    $bb_submenu['site.php'][] = $submenu;
    }
    }
    }

    Tested working. I guess we'll have to do this for several plugins that I have spotted not showing up in the menus. Wordpress went through this growing pain too, it's unfortunate.

    Posted: 2 years ago #
  10. _ck_

    5 stars
    4 stars
    3 stars
    2 stars
    1 star

    Moderator

    After extensive testing, this plugin either never worked right or no longer works with 0.8.2.1

    Basically if you try to use a function that calculates a page for a specific post on another page with another setting via this plugin, it calculates the items per page for the page it's not, not the destination.

    Example:
    On the front-page.php you post a link next to each topic linking to the last post

    The function used is get_topic_last_post_link() but it will generate incorrect page calculations because this plugin forces it to see the setting for the front page count, instead of the destination count (the forum thread)

    The is very fustrating and I am not sure if it's fixable.

    It's problems like these and lack of ability to add universal user interface enhancements to BBpress that make BBpress a non-starter. I am starting to regret choosing it but stuck now as my forum is rather active from all the hundreds of wordpress members.

    Posted: 2 years ago #
  11. _ck_

    5 stars
    4 stars
    3 stars
    2 stars
    1 star

    Moderator

    The hard core hack for the above problem, until it's fixed properly internally, is on line 130 of bb-includes/functions.php in 0.8.2.1

    Change it to:

    if ( is_front() ) {$limit=50;} else {$limit = bb_get_option('page_topics');}

    Where 50 is whatever limit you want for just the front page. Everything else obeys $bb->page_topics

    Obviously core hacks are not recommended and will disappear on an upgrade. But there's no easy way around this, I wasted a few hours trying different techniques but they all are far too messy.

    Posted: 2 years ago #
  12. Everyting seems to be working, except that it doesn't limit the number of latest topics displayed on my front-page. Any idea why that could be?

    Posted: 2 years ago #
  13. Oups. Realised that only happens for a user that is logged in. Is that the way it is supposed to work? Would be nice to be able to limt the topics shown also to logged in users...

    Posted: 2 years ago #
  14. not work with .8.2.1

    Posted: 2 years ago #
  15. citizenkeith

    Member

    It took me forever to figure out this was causing the Jump To Last Post plugin to fail.

    http://bbpress.org/forums/topic/jump-to-last-post?replies=6

    I'll try ck's changes and see what happens. Otherwise, I'll probably pass on this one until it's either added to the standard bb Admin menu or the plugin is rewritten.

    Posted: 2 years ago #
  16. not work with .8.2.1

    How about 0.8.3.1?

    Posted: 2 years ago #
  17. _ck_

    5 stars
    4 stars
    3 stars
    2 stars
    1 star

    Moderator

    This is what I use for 0.8.2 + 0.8.3 installs to make the behaviour work, both page limits are calculated, yet page links should still calculate correctly (both functions are required):

    // fix number of front page topics
    function bb_custom_topic_limit($limit) {
    switch (bb_get_location()) :
    	case  'front-page':  $limit=20;  break;
    	case  'forum-page': $limit=15; break;
    	case  'tag-page':  break;
    	case  'topic-page':  break;
    	case  'feed-page':  break;
    	case  'search-page': break;
    	case  'profile-page': 	break;
    	case  'favorites-page': break;
    	case  'view-page': $limit=25; break;
    	case  'stats-page': $limit=25; break;
    	case 'login-page': break;
    	default:  $limit=15;
    endswitch;
    return $limit;
    }
    add_action( 'bb_get_option_page_topics', 'bb_custom_topic_limit' );
    
    // required to fix for custom topic limits to calculate correct page jumps
    function fix_post_link ($link,$post_id) {
    global $topic;
    remove_action( 'bb_get_option_page_topics', 'bb_custom_topic_limit' );
    if ($topic && $topic->topic_last_post_id==$post_id) {
    	$topic_id=$topic->topic_id;
    	$page=get_page_number( $topic->topic_posts );
    } else {
    	$bb_post = bb_get_post( get_post_id( $post_id ) );
    	$topic_id=$bb_post->topic_id;
    	$page = get_page_number( $bb_post->post_position );
    }
    return  get_topic_link( $topic_id, $page ) . "#post-$post_id";
    }
    add_filter( 'get_post_link','fix_post_link',10, 2);
    Posted: 2 years ago #
  18. _ck_

    5 stars
    4 stars
    3 stars
    2 stars
    1 star

    Moderator

    I have found a minor bug with the routine I use, it needs a lower priority so it runs last.

    add_action( 'bb_get_option_page_topics', 'bb_custom_topic_limit',200);

    works much better... (note the 200 at the end)

    Posted: 2 years ago #
  19. _ck_

    5 stars
    4 stars
    3 stars
    2 stars
    1 star

    Moderator

    I have found two bugs with my routine: one that causes a few unnecessary extra database queries in some rare circumstances when the info is already in bb_cache and another that doesn't use the desired topics per page if the global default is different.

    The additions to to these functions will remove these bugs:

    // fix number of front page topics
    function bb_custom_topic_limit($limit) {
    global $fix_post_link; if (!$fix_post_link) {$location = bb_get_location();} else {$location="topic-page";}
    switch ($location) :
    	case  'front-page':  $limit=15;  break;
    	case  'forum-page': $limit=20; break;
    	case  'tag-page':  break;
    	case  'topic-page':  $limit=15; break;
    	case  'feed-page':  break;
    	case  'search-page': break;
    	case  'profile-page': 	break;
    	case  'favorites-page': break;
    	case  'view-page': $limit=20; break;
    	case  'stats-page': $limit=20; break;
    	case 'login-page': break;
    	default:  $limit=15;
    endswitch;
    return $limit;
    }
    add_action( 'bb_get_option_page_topics', 'bb_custom_topic_limit',200);
    
    // required to fix custom topic limits to calculate correct page jumps
    function fix_post_link ($link,$post_id) {
    global $topic, $bb_topic_cache, $fix_post_link;
    remove_action( 'bb_get_option_page_topics', 'bb_custom_topic_limit',200);
    $topic_id=0; $fix_post_link=true;
    if ($topic && $topic->topic_last_post_id==$post_id) {
    	$topic_id=$topic->topic_id;
    	$page=get_page_number( $topic->topic_posts );
    } elseif ( isset( $bb_topic_cache ) ) {
    	foreach ($bb_topic_cache as $test) {
    		if ($test->topic_last_post_id==$post_id) {$topic_id=$test->topic_id; $page=get_page_number( $test->topic_posts ); break;}
    	}
    }
    if (!$topic_id) {	// all other cache lookup attempts have failed, do a manual lookup
    	$bb_post = bb_get_post( get_post_id( $post_id ) );
    	$topic_id=$bb_post->topic_id;
    	$page = get_page_number( $bb_post->post_position );
    }
    $fix_post_link=false; add_action( 'bb_get_option_page_topics', 'bb_custom_topic_limit',200);
    return  get_topic_link( $topic_id, $page ) . "#post-$post_id";
    }
    add_filter( 'get_post_link','fix_post_link',10, 2);
    Posted: 1 year ago #

RSS feed for this topic

Add a Comment »

You must log in to post.

Code is Poetry.