boonebgorges / buddypress-docs

GNU General Public License v3.0
105 stars 44 forks source link

Group Docs pagination doesn't work #742

Closed boonebgorges closed 11 months ago

boonebgorges commented 11 months ago

From an email report: /page/2 etc doesn't work properly in groups. It shows the first page of docs, and the pagination also shows that you're on the first page.

dcavins commented 11 months ago

This doesn't appear to work in 11 or 12 for the user docs directory or the group docs directory. This fix works: https://github.com/dcavins/buddypress-docs/commit/159eb25da0561422a889bb6be63a327b385854d1

But it's in the wrong place in the code, since this applied to both the members and groups components. Maybe it should just go in BP_Docs_Query::setup_terms() and only run when either bp_is_user() or bp_is_group() is true?

boonebgorges commented 11 months ago

But it's in the wrong place in the code, since this applied to both the members and groups components. Maybe it should just go in BP_Docs_Query::setup_terms() and only run when either bp_is_user() or bp_is_group() is true?

Or even more generally, if ( ! is_archive( 'bp_doc' ) ). setup_terms() seems like semantically the wrong place for it. Maybe instead: In BP_Docs_Query::__construct(), change the default values for paged and posts_per_page to null. Then, in BP_Docs_Query::get_wp_query(), use the pagination variables from bp_action_variables() if the query_args values are null; otherwise, default paged to 1 and posts_per_page to 10. What do you think?

dcavins commented 11 months ago

Boone, this is the answer that works for me: https://github.com/dcavins/buddypress-docs/commit/b1f39bbe9396c227d37489ebaf8df782c0d024d5 I worked on your suggestion, but we're always passing args into BP_Docs_Query::__construct() so the simplest answer was to pass the right args. :)

boonebgorges commented 11 months ago

Yes, that's better anyway. Thank you!

boonebgorges commented 11 months ago

Tested and merged to the 2.2.x branch in https://github.com/boonebgorges/buddypress-docs/commit/b1f39bbe9396c227d37489ebaf8df782c0d024d5