Changeset 7360 for trunk/src/includes/extend/buddypress/groups.php
- Timestamp:
- 11/16/2025 10:43:01 PM (4 months ago)
- File:
-
- 1 edited
-
trunk/src/includes/extend/buddypress/groups.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/extend/buddypress/groups.php
r7357 r7360 484 484 <label for="bbp_group_forum_id"><?php esc_html_e( 'Group Forum:', 'bbpress' ); ?></label> 485 485 <?php 486 bbp_dropdown( array( 487 'select_id' => 'bbp_group_forum_id', 488 'show_none' => esc_html__( '— No forum —', 'bbpress' ), 489 'selected' => $forum_id 490 ) ); 486 bbp_dropdown( 487 array( 488 'select_id' => 'bbp_group_forum_id', 489 'show_none' => esc_html__( '— No forum —', 'bbpress' ), 490 'selected' => $forum_id 491 ) 492 ); 491 493 ?> 492 494 <p class="description"><?php esc_html_e( 'Network administrators can reconfigure which forum belongs to this group.', 'bbpress' ); ?></p> … … 1693 1695 } 1694 1696 1695 /**1696 * Fixes rewrite pagination in BuddyPress Group Forums & Topics.1697 * 1698 * Required for compatibility with BuddyPress > 12.0, where the /groups/1697 /** 1698 * Fixes rewrite pagination in BuddyPress Group Forums & Topics. 1699 * 1700 * Required for compatibility with BuddyPress > 12.0, where the /groups/ 1699 1701 * rewrite rule will be caught before bbPress's /page/ rule. 1700 1702 * … … 1704 1706 * @param string $type Type of variable to check with `is_a()` 1705 1707 * @return mixed $object Verified object if valid, Default or null if invalid 1706 */1707 public function rewrite_pagination( $object, $type = '' ) {1708 */ 1709 public function rewrite_pagination( $object, $type = '' ) { 1708 1710 1709 1711 // Bail if wrong global 1710 if ( 'wp_query' !== $type ) {1711 return $object;1712 }1712 if ( 'wp_query' !== $type ) { 1713 return $object; 1714 } 1713 1715 1714 1716 // Bail if not inside a BuddyPress Group 1715 if ( ! bp_is_group() ) {1716 return $object;1717 }1717 if ( ! bp_is_group() ) { 1718 return $object; 1719 } 1718 1720 1719 1721 // Bail if not inside a BuddyPress Group Forum 1720 if ( ! bp_is_current_action( 'forum' ) ) {1721 return $object;1722 }1722 if ( ! bp_is_current_action( 'forum' ) ) { 1723 return $object; 1724 } 1723 1725 1724 1726 // Default "paged" value 1725 $page_number = null;1726 1727 // Can't use bbp_is_single_topic() because it triggers a loop.1728 $is_single_topic = bp_is_action_variable( 'topic', 0 );1727 $page_number = null; 1728 1729 // Can't use bbp_is_single_topic() because it triggers a loop. 1730 $is_single_topic = bp_is_action_variable( 'topic', 0 ); 1729 1731 1730 1732 // Single Topic 1731 if ( true === $is_single_topic ) {1733 if ( true === $is_single_topic ) { 1732 1734 1733 1735 // Get the page number from 3rd position 1734 if ( bp_is_action_variable( 'page', 2 ) ) {1735 $page_number = bp_action_variable( 3 );1736 }1736 if ( bp_is_action_variable( 'page', 2 ) ) { 1737 $page_number = bp_action_variable( 3 ); 1738 } 1737 1739 1738 1740 // Single Forum 1739 } else {1741 } else { 1740 1742 1741 1743 // Get the page number from 1st position 1742 if ( bp_is_action_variable( 'page', 0 ) ) {1743 $page_number = bp_action_variable( 1 );1744 }1745 }1744 if ( bp_is_action_variable( 'page', 0 ) ) { 1745 $page_number = bp_action_variable( 1 ); 1746 } 1747 } 1746 1748 1747 1749 // Bail if no page number 1748 if ( empty( $page_number ) ) {1749 return $object;1750 }1750 if ( empty( $page_number ) ) { 1751 return $object; 1752 } 1751 1753 1752 1754 // Set the 'paged' WP_Query var to the new action-based value 1753 $object->set( 'paged', $page_number );1755 $object->set( 'paged', $page_number ); 1754 1756 1755 1757 // Return the filtered/modified object 1756 return $object;1757 }1758 return $object; 1759 } 1758 1760 1759 1761 /**
Note: See TracChangeset
for help on using the changeset viewer.