Pagination problem
-
When viewing docs in a profile or on a group page, the pagination does not work. The url changes to …/page/2/ but the list of documents does not change.
It works fine on https://peglearning.com/docs/
The page I need help with: [log in to see the link]
-
Hi @jacobwindham12-
We have previously solved issues very much like the one you describe, so it sounds familiar.
However, I’ve tested the current version, and cannot recreate the problem you’re seeing when visiting a profile’s docs, like: https://bptest.local/members/two/docs/started/page/2/
Are you using the current version of BP Docs? Can you flush your permalinks (visit the settings > permalinks page and hit “save”–you don’t need to change anything). If the problem persists, it could be an issue with your theme. Can you switch to something like Twenty Nineteen and see if the issue is fixed?
-David
Thanks for the quick reply. I’ll test further later tonight. I’m using the WPLMS theme and saw that it was having trouble with previous versions.
I’m using the latest version of BP Docs. I’ve flushed the permalinks. I made a clone install and disabled all plugins but Buddypress, BP Docs, and used the 2019 theme. The pagination is still broken.
Active plugins:
https://prntscr.com/m8zvdt2019 theme on BP Docs page showing “Page 2” with the navigation showing page one and “showing docs 1-6 of 8”
Hi @jacobwindham12-
Thanks for testing the issue thoroughly. Can you capture the query arguments as the page is being built? Here’s an example filter to capture the args:
add_filter( 'bp_docs_pre_query_args', function( $args ) { $towrite = PHP_EOL . '$args: ' . print_r($args, true); $fp = fopen('bp_docs_args.txt', 'a'); fwrite($fp, $towrite); fclose($fp); return $args; }, 999 );
For example, my site’s args look like this:
$args: Array ( [post_type] => bp_doc [tax_query] => Array ( ) [meta_query] => Array ( ) [orderby] => modified [order] => DESC [paged] => 2 [posts_per_page] => 10 [author] => 1 [post_status] => Array ( [0] => publish [1] => trash [2] => bp_docs_pending ) )
I noticed that your site was showing 6 items per page, so I tried changing my setting at Settings > Reading > “Bog pages show at most,” but pagination is still working on my test installation. Is that how you set your per-page number?
What version of WP are you using?
WP version 5.0.3
I am able to change the amount show by changing settings>reading>blog pages
I’m not sure if the theme changes anything.
Where should I add the filter? in functions.php?
Yep,
functions.php
would be fine, as wouldbp-custom.php
. https://codex.buddypress.org/themes/bp-custom-php/The file that is generated should end up in the root directory of your site.
$args: Array ( [post_type] => bp_doc [tax_query] => Array ( ) [meta_query] => Array ( ) [orderby] => modified [order] => DESC [paged] => 0 [posts_per_page] => 6 [author] => 1 [post_status] => Array ( [0] => publish [1] => trash [2] => bp_docs_pending ) ) $args: Array ( [post_type] => bp_doc [tax_query] => Array ( ) [meta_query] => Array ( ) [orderby] => modified [order] => DESC [paged] => 0 [posts_per_page] => 6 [author] => 1 [post_status] => Array ( [0] => publish [1] => trash [2] => bp_docs_pending ) ) $args: Array ( [post_type] => bp_doc [tax_query] => Array ( ) [meta_query] => Array ( ) [orderby] => modified [order] => DESC [paged] => 0 [posts_per_page] => 6 [author] => 1 [post_status] => Array ( [0] => publish [1] => trash [2] => bp_docs_pending ) )
-
This reply was modified 6 years, 1 month ago by
jacobwindham12.
Well, that’s weird that the
paged
is getting steamrolled. Can you try this code?add_filter( 'bp_docs_pre_query_args', function( $args ) { global $wp_query; $towrite = PHP_EOL . '$args paged: ' . print_r($args['paged'], true); $towrite .= PHP_EOL . '$wp_query paged: ' . print_r($wp_query->get( 'paged' ), true); $fp = fopen('bp_docs_args.txt', 'a'); fwrite($fp, $towrite); fclose($fp); return $args; }, 999 );
I’m assuming that you’re trying this code on the installation that only has BP + BP Docs activated. And it might be worth flushing permalinks again, because the pagination arguments are picked up by rules set there.
Thanks!
No luck. I created a bp-custom.php at …/wp-content/plugins and added the code on a test installation with bp + bp docs + 2019 theme.
What was output to the bp_docs_args.txt file? We’re still trying to figure out what is stomping the pagination arguments.
Thanks!
$args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0 $args paged: 0 $wp_query paged: 0
Does pagination work on your blog? (I ask because BP Docs’ “started by me” screen is using WP’s built-in pagination rules, not adding custom rules.) You can check to see which of WP’s rewrite rules are being used by installing a plugin called “Query Monitor” and clicking the “Request” link as shown in this screenshot: https://imgur.com/a/HsIysBA
Here are the expected results from my test installation:
Request
members/admin/docs/started/page/2Matched Rule
(.?.+?)/page/?([0-9]{1,})/?$Matched Query
pagename=members%2Fadmin%2Fdocs%2Fstarted
&paged=2Hi David
I’m also having a similar problem. When a clicking the documents tab in the group, the listing does not show. /docs does work but the display is odd.
/groups/group-name/docs/ doesn’t bring up document list.I have disabled all plugins on a staging site except for buddypress and buddypress docs, changed to the twenty ninteen theme (I’m using sweetdate), regenerated the permalinks – and rolled back the buddypress docs plugin through several releases – all to no avail.
Paul
-
This reply was modified 5 years, 10 months ago by
padykule.
I have found that if I roll back the buddypress docs version to 1.8.6 – it works fine!
That’s funny because we resolved some pagination bugs is 1.8.7. If you upgrade back to 1.8.7 does it break immediately?
-
This reply was modified 6 years, 1 month ago by
- The topic ‘Pagination problem’ is closed to new replies.