Changeset 12321 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/functions.php
- Timestamp:
- 12/13/2022 06:31:15 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/functions.php
r11945 r12321 800 800 } 801 801 add_filter( 'bbp_after_theme_compat_reset_post_parse_args', 'wporg_support_set_is_single_on_single_replies' ); 802 803 /** 804 * Add query vars 805 */ 806 function wporg_add_query_vars( array $vars ) : array { 807 // For https://wordpress.org/support/users/foo/edit/account/. 808 // See `site-support.php` for the rewrite rule. 809 $vars[] = 'edit_account'; 810 811 return $vars; 812 } 813 add_filter( 'query_vars', 'wporg_add_query_vars' ); 814 815 /** 816 * Detect if the current request is for editing a bbPress Account 817 * 818 * The Account screen is a custom modification where the security settings are moved to a separate screen. 819 */ 820 function wporg_bbp_is_single_user_edit_account() : bool { 821 global $wp_query; 822 823 return $wp_query->get( 'bbp_user', false ) && $wp_query->get( 'edit_account', false ); 824 } 825 826 /** 827 * Determine if the current request is to show a profile. 828 * 829 * This is necessary because `bbp_parse_query()` assumes that the current page is a Profile if it doesn't match 830 * any of the other built-in pages, rather than checking that the current page actually is a request for a profile. 831 */ 832 function wporg_is_single_user_profile( bool $is_single_user_profile ) : bool { 833 // True for https://wordpress.org/support/users/foo/ but not https://wordpress.org/support/users/foo/edit/account/. 834 // See `site-support.php` for the rewrite rule. 835 if ( $is_single_user_profile ) { 836 $is_single_user_profile = ! wporg_bbp_is_single_user_edit_account(); 837 } 838 839 return $is_single_user_profile; 840 } 841 add_filter( 'bbp_is_single_user_profile', 'wporg_is_single_user_profile' ); 802 842 803 843
Note: See TracChangeset
for help on using the changeset viewer.