PluginProbe
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor / 4.0.3
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor v4.0.3
4.0.3 4.0.2 4.0.1 4.0.0 3.16.6 3.16.5 3.16.4 3.16.3 3.16.2 3.16.1 3.16.0 3.15.9 3.9.9 3.9.5 3.9.6 3.9.7 3.9.8 1.1.7 1.1.8 1.1.9 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 All 341 releases
← All changes | admin/advanced-settings/includes/userlisting/modify-permalinks-single.php +26 -5 3.15.9 → 4.0.3 View file →
@@ -8,14 +8,22 @@
8 8 if ( $base == false ) return;
9 9
10 10 $rules = get_option( 'rewrite_rules' );
11 11 $frontpage_id = get_option( 'page_on_front' );
12 + $lang_pattern = function_exists( 'wppb_userlisting_get_language_pattern' ) ? wppb_userlisting_get_language_pattern() : '';
12 13
13 - if ( !isset($rules['(.+?)/'.$base.'/([^/]+)']) ||
14 + $needs_flush = (
15 + !isset($rules['(.+?)/'.$base.'/([^/]+)']) ||
14 16 !isset($rules['(.?.+?)/' . wppb_get_users_pagination_slug() . '/?([0-9]{1,})/?$'] ) ||
15 - ( !empty( $frontpage_id ) && !isset( $rules[wppb_get_users_pagination_slug() . '/?([0-9]{1,})/?$'] ) ) ) {
17 + ( !empty( $frontpage_id ) && !isset( $rules[wppb_get_users_pagination_slug() . '/?([0-9]{1,})/?$'] ) )
18 + );
19 +
20 + if ( ! $needs_flush && $lang_pattern !== '' && ! isset( $rules[ $lang_pattern . '/(.+?)/' . $base . '/([^/]+)' ] ) ) {
21 + $needs_flush = true;
22 + }
23 +
24 + if ( $needs_flush ) {
16 25 global $wp_rewrite;
17 -
18 26 $wp_rewrite->flush_rules();
19 27 }
20 28 }
21 29 add_action( 'wp_loaded', 'wppb_toolbox_flush_rewrite_rules' );
@@ -27,15 +35,28 @@
27 35
28 36 $wppb_addonOptions = get_option('wppb_module_settings');
29 37
30 38 if( $wppb_addonOptions['wppb_userListing'] == 'show' ) {
31 - $new_rules = array();
39 + $new_rules = array();
40 + $frontpage_id = get_option('page_on_front');
41 + $lang_pattern = function_exists( 'wppb_userlisting_get_language_pattern' ) ? wppb_userlisting_get_language_pattern() : '';
32 42
43 + // Polylang compatibility: capture the language slug separately so the pagename only
44 + // contains the actual page slug.
45 + if ( $lang_pattern !== '' ) {
46 + $new_rules[ $lang_pattern . '/(.+?)/' . $base . '/([^/]+)' ] = 'index.php?lang=$matches[1]&pagename=$matches[2]&username=$matches[3]';
47 +
48 + if ( !empty($frontpage_id) ) {
49 + $new_rules[ $lang_pattern . '/' . wppb_get_users_pagination_slug() . '/?([0-9]{1,})/?$' ] = 'index.php?lang=$matches[1]&page_id=' . $frontpage_id . '&wppb_page=$matches[2]';
50 + }
51 +
52 + $new_rules[ $lang_pattern . '/(.?.+?)/' . wppb_get_users_pagination_slug() . '/?([0-9]{1,})/?$' ] = 'index.php?lang=$matches[1]&pagename=$matches[2]&wppb_page=$matches[3]';
53 + }
54 +
33 55 //user rule
34 56 $new_rules['(.+?)/'. $base .'/([^/]+)'] = 'index.php?pagename=$matches[1]&username=$matches[2]';
35 57
36 58 //users-page rule
37 - $frontpage_id = get_option('page_on_front');
38 59 if (!empty($frontpage_id)) {
39 60 $new_rules[wppb_get_users_pagination_slug() . '/?([0-9]{1,})/?$'] = 'index.php?&page_id=' . $frontpage_id . '&wppb_page=$matches[1]';
40 61 }
41 62